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
Direct colonial rule Direct colonial rule Direct colonial rule is a form of colonialism that involves the establishment of a centralized foreign authority within a territory, which is run by colonial officials. According to Michael W. Doyle of Harvard University, in a system of direct rule, the native population is excluded from all but the lowest level of the colonial government. Ugandan academic Mahmood Mamdani classifies direct rule as centralized despotism: a system where natives were not considered citizens. The opposite of direct colonial rule is indirect rule, which integrates pre-established local elites and native institutions into the administration of the colonial government.