the two were never agreed upon. In 1845 the United States annexed Texas, leading to a major border dispute and eventually to the Mexican–American War. Mexican–American War (1846–1848) The Mexican–American War was fought from 1846 to 1848. Mexico refused to acknowledge that its runaway state of Texas had achieved independence and warned that annexation to the United States would mean war. The United States annexed Texas in late 1845, and the war began the next spring. U.S. President James K. Polk encouraged Congress to declare war following a number of skirmishes on the Mexican–American border. The war proved disastrous for Mexico; the Americans seized New Mexico and California and invaded Mexico's northern provinces. In September 1847, U.S. troops under General Winfield Scott captured Mexico City. The war ended in a decisive U.S. victory; the Treaty of Guadalupe Hidalgo ended the conflict. As a result, Mexico was forced to sell all of its northernmost territory, including California and New Mexico, to the United States in the Mexican Cession. Additionally, Mexico relinquished its claims to Texas, and the United States forgave Mexico's debts to U.S. citizens. Mexicans in the annexed areas became full U.S. citizens. There had been much talk early in the war about annexing all of Mexico, primarily to enlarge the areas open to slavery. However, many Southern political leaders were in the invasion armies and they recommended against total annexation because of the differences in political culture between the United States and Mexico. In 1854 the United States purchased an additional of desert land from Mexico in the Gadsden Purchase; the price was $10 million. The goal was to build a rail line through southern Arizona to California. 1850s Mexican President Antonio López de Santa Anna sold Mexican territory to the United States in which is known as the Gadsden Purchase, allowing the U.S. to build a railway line more easily through that region. That purchase played a significant role in the ouster of Santa Anna by Mexican liberals, in what is known as the Revolution of Ayutla, since it was widely viewed as selling Mexico's patrimony.\ As the liberals made significant political changes in Mexico and a civil reform war broke out between conservative opponents to the liberal reform, the liberal government of Benito Juárez negotiated with the U.S. to enable the building of an interoceanic route in southern Mexico. A treaty was concluded in 1859 between Melchor