1846–1848: Mexican–American War: On May 13, 1846, the United States recognized the existence of a state of war with Mexico. After the annexation of Texas in 1845, the United States and Mexico failed to resolve a boundary dispute and President Polk said that it was necessary to deploy forces in Mexico to meet a threatened invasion.