Spanish attempts to reconquer Mexico
Mexican independence was officially achieved on September 27, 1821, under the Treaty of Córdoba. Spain did not recognize the treaties, arguing that the viceroy Juan O'Donojú had no authority to recognize the independence of any overseas province. This situation was dangerous to the newly acquired independent status of the nation, which had not yet been recognized by any of the European powers that could support it, and the threat of Spanish reconquest was a constant worry to the leaders of the nascent regime. On May 13, 1822 decrees were issued by the government to imprison anyone who conspired against Mexico's independence.
New Spain
In the 1821 Declaration of Independence of the Mexican Empire, both Mexico and Central America declared their independence after three centuries of Spanish rule and formed the First Mexican Empire, although Central America quickly rejected the union. After priest Miguel Hidalgo y Costilla's 1810 Grito de Dolores (call for independence), the insurgent army began an eleven-year war. At first, the Criollo class fought against the rebels. But in 1820, a military coup in Spain forced Ferdinand VII to accept the authority of the liberal Spanish Constitution. The specter of liberalism that could undermine the authority and autonomy of the Roman Catholic Church made the Church hierarchy in New Spain view independence in a different light. In an independent nation, the Church anticipated retaining its power. Royalist military officer Agustín de Iturbide proposed uniting with the insurgents with whom he had battled, and gained the alliance of Vicente Guerrero, leader of the insurgents in a region now bearing his name. Royal government collapsed in New Spain and the Army of the Three Guarantees marched triumphantly into Mexico City in 1821.