The arrival of the Spaniards in Guatemala began in 1524 with the conquest of the territory under the command of Pedro de Alvarado. After the conquest and the colonial era, more people came to the country, not as conquerors, but to do business or daily activities. The Spanish embassy in Guatemala City reports some 9,311 Spaniards living in Guatemala in 2014. Early European immigrants from Guatemala were Spaniards who conquered the indigenous Mayan population in 1524. They ruled for almost 300 years. Although the Spanish conquest of Guatemala was primarily the result of its technical superiority, the Spaniards were helped by the Mayans who were already involved in a bitter internal struggle. After a period of political instability exacerbated by the collapse of the world market for indigo, main exporter in the region of Europe, each province seceded from the federation, starting with Costa Rica. The federation collapsed between 1838 and 1840, when Guatemala became an independent nation.