The Mexican-American War lasted from 1846 to 1848 and was fought between the United States and Mexico over the annexation of Texas and Mexico's northern lands by the U.S. The war started when Mexican troops attacked U.S. soldiers stationed in the disputed border region along the Rio Grande in 1846, and resulted in U.S. victories that expanded its territory significantly. Through the Treaty of Guadalupe Hidalgo in 1848, Mexico ceded over 500,000 square miles of territory, including parts of modern day California, Utah, Nevada, Arizona, New Mexico, Colorado, and Wyoming, deepening tensions between slave and free states.