On May 13, 1846, the U.S. Congress overwhelmingly votes in favor of President James K. Polk’s request to declare war on Mexico in a dispute over Texas.

Under the threat of war, the United States had refrained from annexing Texas after the latter won independence from Mexico in 1836. But in 1844, President John Tyler restarted negotiations with the Republic of Texas, culminating with a Treaty of Annexation. The treaty was defeated by a wide margin in the Senate because it would upset the slave state/free state balance between North and South and risked war with Mexico, which had broken off relations with the United States. But shortly before leaving office and with the support of President-elect Polk, Tyler managed to get the joint resolution passed on March 1, 1845. Texas was admitted to the union on December 29.

While Mexico didn’t follow through with its threat to declare war, relations between the two nations remained tense over border disputes, and in July 1845, President Polk ordered troops into disputed lands that lay between the Neuces and Rio Grande rivers. In November, Polk sent the diplomat John Slidell to Mexico to seek boundary adjustments in return for the U.S. government’s settlement of the claims of U.S. citizens against Mexico and also to make an offer to purchase California and New Mexico. After the mission failed, the U.S. army under Gen. Zachary Taylor advanced to the mouth of the Rio Grande, the river that the state of Texas claimed as its southern boundary.

Mexico, claiming that the boundary was the Nueces River to the northeast of the Rio Grande, considered the advance of Taylor’s army an act of aggression and in April 1846 sent troops across the Rio Grande. Polk, in turn, declared the Mexican advance to be an invasion of U.S. soil, and on May 11, 1846, asked Congress to declare war onMexico, which it did two days later.

After nearly two years of fighting, peace was established by the Treaty of Guadalupe Hidalgo, signed on February 2, 1848. The Rio Grande was made the southern boundary of Texas, and California and New Mexico were ceded to the United States. In return, the United States paid Mexico the sum of $15 million and agreed to settle all claims of U.S. citizens against Mexico.

READ MORE: 10 Things You May Not Know About the Mexican-American War