Mexican War of Independence
Iturbide's assignment to the Oaxaca expedition coincided with a successful military coup in Spain against the monarchy of Ferdinand VII. The coup leaders, part of an expeditionary force assembled to suppress the independence movements in the Americas, had turned against the monarchy. They compelled the reluctant Ferdinand to reinstate the liberal Spanish Constitution of 1812 that created a constitutional monarchy. When news of the liberal charter reached Mexico, Iturbide perceived it both as a threat to the status quo and a catalyst to rouse the criollos to gain control of Mexico. Independence was achieved when conservative Royalist forces in the colonies chose to rise up against the liberal regime in Spain; it was an about-face compared to their previous opposition to the peasant insurgency. After an initial clash with Guerrero's forces, Iturbide assumed command of the royal army. At Iguala, he allied his formerly royalist force with Guerrero’s radical insurgents to discuss the renewed struggle for independence.
Costa Rica–Mexico relations
Costa Rica and Mexico are two Latin American nations that share a common history in the fact that both nations were colonized by the Spanish empire. During Spanish colonization, Costa Rica was under the administration of the Viceroyalty of New Spain in Mexico City. In 1821, Mexico gained independence from Spain and Costa Rica became part of the First Mexican Empire. In 1823, the empire dissolved and Costa Rica, along with El Salvador, Guatemala, Honduras and Nicaragua joined the United Provinces of Central America. In 1838, the union dissolved and Costa Rica became an independent nation. That same year, Costa Rica and Mexico established diplomatic relations.