Spanish attempts to reconquer Mexico

The Spanish attempts to reconquer Mexico occurred from 1821 to 1829 in the aftermath of the Mexican War of Independence. The Spanish made several attempts to reconquer Mexico, and, while they failed, they succeeded in destabilizing the Mexican government and economy.

Background
On 27 September 1821, Spain and Mexico signed the Treaty of Cordoba, which recognized Mexican independence as the First Mexican Empire under Emperor Agustin Iturbide. However, the Spanish monarchy argued that Viceroy of New Spain Juan O'Donoju did not have the authority to grant independence to Mexico; the Spanish also maintained a garrison at San Juan de Ulua in Veracruz. On 26 October 1821, Generals Jose Garcia Davila and Antonio Lopez de Santa Anna moved the Veracruz port garrison to the San Juan de Ulua fortress, ignoring orders to surrender; soon, Cuban reinforcements arrived, swelling the Spanish army's numbers to 2,000 troops. As the Spanish frequently changed the commanders of Ulua, Iturbide set about creating the Mexican Navy from British and American warships, preparing to blockade the port. On 25 September 1823, the peace talks were suspended when the Spanish bombarded Veracruz, displacing more than 6,000 civilians.

Wars
On 8 October 1823, the Mexican Navy began its blockade of Veracruz in response to the Spanish naval bombardment, and, over the course of two years, the Mexicans ensured that the Spanish garrison was unable to receive assistance from Havana. On 23 November 1825, San Juan de Ulua - the last Spanish stronghold in Mexico - surrendered. The Spanish still refused to recognize the independence of Mexico, so President Guadalupe Victoria planned a Mexican conquest of Cuba to deprive the Spanish of a base for further invasions of Mexico. While the United States insisted on Spain's retention of Cuba, the Mexican Navy employed US Navy commodore David Porter to attack Spain's maritime lines around Cuba. On 10 February 1828, Porter's Mexican fleet was defeated at Mariel, and Porter sent his wounded son, the future Union admiral David Dixon Porter, back to New Orleans and out of harm's way. One year later, Spain once again attempted to reconquer Mexico. The Spanish general Isidro Barradas and 3,586 Spanish soldiers left Spain aboard a Spanish Navy fleet, and the Spanish fleet arrived at Cabo Rojo (near Tampico) on 26 July 1829. The Spanish advanced on Tampico, but they were defeated at Pueblo Viejo on 10-11 September 1829, and Barradas was forced to surrender to Antonio Lopez de Santa Anna, the Spanish general who had since defected to Mexico. On 28 December 1836, Spain recognized the independence of Mexico, the first former colony whose independence was recognized by Spain.