The Mexican-American War was a war fought between the United States and Mexico between 1846 and 1848. It is also called the US-Mexico War. In the US it is also known as the Mexican War; in Mexico it is also known as the North American Invasion of Mexico, the United States War Against Mexico, and the War of Northern Aggression (this last name is more commonly used in the Southern United States to refer to the American Civil War).
The war grew out of the Mexican conflict with Texas. After having won its independence from Mexico in 1836, the Republic of Texas was annexed by the United States in 1845; however, the Mexican government disputed the southern border of Texas. That same year tensions between the two countries over territory were raised when the United States government offered to pay off the Mexican debt to American settlers if Mexico allowed the U.S. to purchase the Mexican territories of California and New Mexico from Mexico, which some Mexicans found offensive.
An interesting side note of the war was the Saint Patrick's Battalion (San Patricios), a group, approximately 500-strong, of (largely Irish-born) Americans who deserted the US Army in favor of the Mexican side. Many of them fought against what they alleged was brutal, racist discrimination received from the US. Many identified with Mexico as Catholics. They were hanged by the US; making sure that the last thing these Irish men saw was the lowering of the Mexican flag and the raising of the U.S. flag as the war was won. Some historians claim that these men were prisoners of war. Others argue that they were traitors and deserters. There are many monuments to these soldiers in present-day Mexico.