When Texas revolted against Mexico in 1836, Mexico refused to recognize its independence. It warned the United States that if Texas were admitted to the Union, Mexico would declare war. James K. Polk
was elected President in 1844 on a platform that advocated admitting Texas. In 1845, Texas wsa made a state and Mexico broke off relations. The southern border of Texas remained an issue, with Texas claiming the Rio Grande City
and Mexico holding to the Nueces River.
In the fall of 1845, Polk sent John Slidell to Mexico on a mission to settle disputes. Instead, he was rebuffed. General Zachary Taylor advanced to the Rio Grande. There he fought and lost a battle. The United States declared war on May 13, 1846.
The United States occupied Santa Fe in August, 1846. General Zachary Taylor had driven the Mexicans back to Matamoros. President James K. Polk decided to land troops at Veracruz. Americans captured Mexico City in 1847. The Treaty of Guadalupe Hidalgo ended the war in 1848.