Mexican–American War from the war of independence (1810–1821) as a weak and divided force. Before the war with the United States, the military faced both internal and foreign challenges. The Spanish still occupied the coastal fortress of San Juan de Ulúa, and Spain did not recognize Mexico's independence, so that the new nation was at risk for invasion. In 1829, the Spanish attempted to reconquer their former colony and Antonio López de Santa Anna became a national hero defending the homeland. The army had a set of privileges ("fueros"), established in the colonial era, that gave it jurisdiction over many aspects of
First Mexican Empire First Mexican Empire The Mexican Empire (, ) was a short lived monarchy, and the first independent post-colonial imperial state in Mexico. It was the only former colony of the Spanish Empire to establish a monarchy after independence. Together with the Brazilian Empire, it was one of two European-style empires in the Americas. The Mexican Empire lasted two years. It existed from the signing of the Treaty of Córdoba and the declaration of Independence of the Mexican Empire in September 1821 until the emperor's abdication in March 1823 when the Provisional Government took power and the First Mexican Republic was