The Mexican–American 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.

After its Treaty of Córdoba, thereby obtaining independence in 1821 from the Kingdom of Spain and its Spanish Empire, having been known as New Spain for the preceding 300 years, and after a brief experiment with monarchy, Mexico became 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.[4]