The Mexican–American War, also known as the Mexican War, the U.S.–Mexican War, the U.S.–Mexico War or the Invasion of Mexico (Spanish: Intervención estadounidense en México, Guerra de Estados Unidos-México), was an armed conflict between the United States of America and the United Mexican States from 1846 to 1848. It followed in the wake of the 1845 U.S. annexation of Texas, which Mexico considered part of its territory in spite of its de facto secession in the 1836 Texas Revolution.
After its independence in 1821 and brief experiment with monarchy, Mexico became a republic in 1824. It was characterized by considerable instability, leaving it ill-prepared for conflict when war broke out in 1846.Native American raids in Mexico's sparsely settled north in the decades preceding the war prompted the Mexican government to sponsor migration from the U.S. to the Mexican province of Texas to create a buffer. However, Texans from both countries revolted against the Mexican government in the 1836 Texas Revolution, creating a republic not recognized by Mexico, which still claimed it as part of its national territory. In 1845, Texas agreed to an offer of annexation by the U.S. Congress, and became the 28th state on December 29 that year.
In 1845, James Polk, the newly-elected U.S. president, made a proposition to the Mexican government to purchase the disputed lands between the Nueces River and the Rio Grande. When that offer was rejected, American forces commanded by Major General Zachary Taylor were moved into the disputed territory. They were then attacked by Mexican forces, who killed 12 U.S. soldiers and took 52 as prisoners. These same Mexican troops later laid siege to an American fort along the Rio Grande. This led to the war and the eventual loss of much of Mexico's northern territory.
U.S. forces quickly occupied Santa Fe de Nuevo México and Alta California Territory, and then invaded parts of Central Mexico (modern-day Northeastern Mexico and Northwest Mexico); meanwhile, the Pacific Squadron conducted a blockade, and took control of several garrisons on the Pacific coast farther south in Baja California Territory. The U.S. army, under the command of Major General Winfield Scott, captured the capital, Mexico City, marching from the port of Veracruz.