The war between the U.S. and its southern neighbor began the year before when President James Polk ordered General Zachary Taylor to advance to the disputed Rio Grande border between the newly-minted American state of Texas and Mexico. The Mexican government had once controlled Texas and refused to recognize the American claim on the state or the validity of the Rio Grande as an international border. Viewing Taylor’s advance as an invasion of Mexican soil, the Mexican army crossed the Rio Grande and attacked the U.S. forces in Texas in April 1846. By mid-May the two nations were formally at war.
The Mexican army was larger than the American army, but its leadership, training, and supplies were all inferior to those of the U.S. forces. Mexican gunpowder was notoriously weak, and cannon balls from their guns often just bounced slowly across battlefields where the American soldiers simply stepped out of the way. As a result, by January 1847, General Taylor had conquered California and the northern Mexican territories that would later make up much of the American southwest. But Taylor was reluctant to take the war into the heart of Mexico, and Polk instead turned to General Winfield Scott to finish the job.
In March, Scott landed nearly 12,000 men on the beaches near Vera Cruz, Mexico, captured the town, and began to march inland to Mexico City. Flanking the Mexican defenses at Cerro Gordo Pass, Scott stabbed southward below Mexico City, taking the towns of Contreras and Churubusco. When a final attempt at peace negotiations failed in August, Scott advanced north on the Mexican capital. After Scott’s forces stormed the fortress at Chapultepec, the last significant Mexican resistance was eliminated. The next day, September 14, Scott marched his army into Mexico City and raised the American flag over the Mexican National Palace-the “Halls of Montezuma” later celebrated in the famous Marine’s Hymn. For the first time in U.S. history, the Stars and Stripes flew over a foreign capital.