In June 1845, the United States decided to add Texas to the United States. President Polk sent the United States military to take over the area. The two sides fought for two years. Finally, Mexico surrendered. On February 2, 1848, it signed the Treaty of Guadalupe Hidalgo, which ended the war. It also gave the United States all of the land above the teritorty . This meant the United States had gained all of Texas, Arizona, and New Mexico; parts of Utah, Nevada, and Colorado; and northern California.