Throughout the 1820s, Americans settled in the vast territory of Texas, often with land grants from the Mexican government. Their numbers soon alarmed the authorities, however, who prohibited further immigration in 1830. In 1834 General Antonio Lopez de Santa Anna established a dictatorship in Mexico, and the following year Texans revolted. Santa Anna defeated the American rebels at the celebrated siege of the Alamo in early 1836, but Texans under Sam Houston destroyed the Mexican army and captured Santa Anna a month later at the Battle of San Jacinto, ensuring Texan independence. For almost a decade, Texas remained an independent republic, becoming the 28th state in 1845.
Although Mexico broke relations with the United States over the issue of Texas statehood, the most contentious issue was the new state's border: Texas claimed the Rio Grande River; Mexico argued that the border stood far to the north along the Nueces River. Meanwhile, settlers were flooding into the territories of New Mexico and California at a time when many Americans claimed that the United States had a "manifest destiny" to expand westward to the Pacific Ocean.
U.S. attempts to buy the New Mexico and California territories failed, and after a clash of Mexican and U.S. troops along the Rio Grande, the United States declared war in 1846. U.S. forces occupied the territory of New Mexico, then supported the revolt of settlers in California. A U.S. force under Zachary Taylor invaded Mexico, winning victories at Monterey and Buena Vista, but failing to bring Mexico to the negotiating table. In March 1847, U.S. forces commanded by Winfield Scott landed near Vera Cruz on Mexico's east coast, and after a series of heavy engagements, entered Mexico City. Nevertheless, it was only after the resignation of Santa Anna that the United States was able to negotiate the Treaty of Guadalupe Hildago in which Mexico ceded the Southwest region and California for $15 million.
The war proved to be a training ground for American officers who would later fight on both sides in the Civil War. It was also a politically divisive war in which antislavery Whigs criticized the Democratic administration of James K. Polk for expansionism.
With the conclusion of the Mexican War, the United States gained a vast new territory of 1.36 million square kilometers encompassing the present-day states of Arizona, Nevada, California, Utah and parts of New Mexico, Colorado and Wyoming. But it was also a poisoned acquisition because it revived the most explosive question in American politics of the time: would the new territories be slave or free?