Mexican–American War
Political divisions

There were significant political divisions in Mexico which seriously impeded the war effort. Inside Mexico, the conservative centralistas and liberal federalists vied for power, and at times these two factions inside Mexico's military fought each other rather than the invading U.S. Army. Santa Anna bitterly remarked, "However shameful it may be to admit this, we have brought this disgraceful tragedy upon ourselves through our interminable in-fighting."

During the conflict, presidents held office for a period of months, sometimes just weeks, or even days. Just before the outbreak of the war, liberal General José Joaquín de Herrera was president (December 1844 – December 1845) and willing to engage in talks so long as he did not appear to be caving to the U.S., but he was accused by many Mexican factions of selling out his country (vendepatria) for considering it. He was overthrown by Conservative Mariano Paredes (December 1845 – July 1846), who left the presidency to fight the invading U.S. Army and was replaced by his vice president Nicolás Bravo (July 28, 1846 – August 4, 1846). The conservative Bravo was overthrown by federalist liberals who re-established the federal Constitution of 1824. José Mariano Salas (August 6, 1846 – December 23, 1846) served as president and held elections under the restored federalist system. General Antonio López de Santa Anna won those elections, but as was his practice, he left the administration to his vice president, who was again liberal Valentín Gómez Farías (December 23, 1846 – March 21, 1847). In February 1847, conservatives rebelled against the liberal government's attempt to take Church property to fund the war effort. In the Revolt of the Polkos, the Catholic Church and conservatives paid soldiers to rise against the liberal government. Santa Anna had to leave his campaign to return to the capital to sort out the political mess.

Santa Anna briefly held the presidency again, from March 21, 1847 – April 2, 1847. His troops were deprived of support that would allow them to continue the fight. The conservatives demanded the removal of Gómez Farías, and this was accomplished by abolishing the office of vice president. Santa Anna returned to the field, replaced in the presidency by Pedro María de Anaya (April 2 – May 20, 1847). Santa Anna returned to the presidency on May 20, 1847, when Anaya left to fight the invasion, serving until September 15, 1847. Preferring the battlefield to administration, Santa Anna left office again, leaving the office to Manuel de la Peña y Peña (September 16 – November 13, 1847).

With U.S. forces occupying the Mexican capital and much of the heartland, negotiating a peace treaty was an exigent matter, and Peña y Peña left office to do that. Pedro María Anaya returned to the presidency on November 13, 1847 – January 8, 1848. Anaya refused to sign any treaty that ceded land to the U.S., despite the situation on the ground with Americans occupying the capital. Peña y Peña resumed the presidency January 8, 1848 – June 3, 1848, during which time the Treaty of Guadalupe Hidalgo was signed, bringing the war to an end.
punctuation:no_comma, combination:repeat_prompt, detectable_format:constrained_response