The Mexican–American War, also known as the Mexican War, the U.S.–Mexican War or the Invasion of Mexico, was an armed conflict between the United States and the Centralist Republic of Mexico (which became the Second Federal Republic of Mexico during the war) from 1846 to 1848. It followed in the wake of the 1845 U.S. annexation of Texas, which Mexico considered part of its territory, despite the 1836 Texas Revolution. It was the fourth of the five major wars fought on American soil which was preceded by the Seven Years’ War, the War of Independence and the War of 1812 and succeeded by the Civil War. Combat operations lasted a year and a half, from the spring of 1846 to the fall of 1847. American forces quickly occupied New Mexico and California, then invaded parts of Northeastern Mexico and Northwest Mexico; meanwhile, the Pacific Squadron conducted a blockade, and took control of several garrisons on the Pacific coast further south in Baja California. Another American army captured Mexico City, and the war ended in a victory for the United States. The Treaty of Guadalupe Hidalgo specified the major consequence of the war: the forced Mexican Cession of the territories of Alta California and New Mexico to the United States in exchange for $15 million. In addition, the United States assumed $3.25 million of debt owed by the Mexican government to U.S. citizens. Mexico accepted the loss of Texas and thereafter cited the Rio Grande as its national border. American territorial expansion to the Pacific coast had been the goal of President James K. Polk, the leader of the Democratic Party. However, the war was highly controversial in the United States, with the Whig Party, anti-imperialists and anti-slavery elements strongly opposed. Heavy American casualties and high monetary cost were also criticized. The political aftermath of the war raised the slavery issue in the United States, leading to intense debates that pointed to civil war; the Compromise of 1850 provided a brief respite.