The MexicanAmerican War,[a] also known as the Mexican War in the United States and in Mexico as the American intervention in Mexico,[b] was an armed conflict between the United States of America and the United Mexican States (Mexico) from 1846 to 1848. It followed in the wake of the 1845 American annexation of the independent Republic of Texas, which Mexico still considered its northeastern province and a part of its territory after its de facto secession in the 1836 Texas Revolution a decade earlier.
Mexico obtained independence from Spain and the Spanish Empire with the Treaty of Crdoba in 1821, and briefly experimented with monarchy, becoming a republic in 1824. It was characterized by considerable instability, leaving it ill-prepared for international conflict only two decades later, when war broke out in 1846. In the decades preceding the war, Native American raids in Mexico's sparsely settled north prompted the Mexican government to sponsor migration from the United States to the Mexican province of Texas to create a buffer. However, the newly named "Texians" revolted against the Mexican government of President/dictator Antonio Lpez de Santa Anna, who had usurped the Mexican Constitution of 1824, in the subsequent 1836 Texas Revolution, creating a republic not recognized by Mexico, which still claimed it as part of its national territory. In 1845, the Texan Republic agreed to an offer of annexation by the U.S. Congress and became the 28th state in the Union on December 29 that year.