After gaining independence from Spain in the 1820s, Mexico welcomed foreign settlers to sparsely populated Texas, and a large group of Americans led by Stephen F. Austin settled along the Brazos River. The Americans soon outnumbered the resident Mexicans, and by the 1830s attempts by the Mexican government to regulate these semi-autonomous American communities led to rebellion. In March 1836, in the midst of armed conflict with the Mexican government, Texas declared its independence from Mexico.The Texas volunteers initially suffered defeat against the forces of Mexican General Santa Anna–the Alamo fell and Sam Houston’s troops were forced into an eastward retreat. However, in late April, Houston’s troops surprised a Mexican force at San Jacinto, and Santa Anna was captured, bringing an end to Mexico’s efforts to subdue Texas.
The citizens of the independent Republic of Texas elected Sam Houston president but also endorsed the entrance of Texas into the Union. The likelihood of Texas joining the Union as a slave state delayed any formal action by the U.S. Congress for more than a decade. In 1844, Congress finally agreed to annex the territory of Texas. On December 29, 1845, Texas entered the United States as a slave state, broadening the irrepressible differences in the United States over the issue of slavery and setting off the Mexican-American War.