<Tr> <Td> <Ul> <Li> </Li> <Li> </Li> <Li> </Li> </Ul> </Td> </Tr> <Ul> <Li> </Li> <Li> </Li> <Li> </Li> </Ul> <P> The Mexican--American War, also known as the Mexican War in the United States and in Mexico as the American intervention in Mexico, 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 . </P> <P> Mexico, which obtained independence from the Kingdom of Spain and its Spanish Empire with the Treaty of Córdoba in 1821, and which briefly experimented with monarchy, 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 . 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 López 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 . </P>

What was the primary cause of the mexican american war
find me the text answering this question