The area known as Texas was originally inhabited by various indigenous peoples. In the 16th century, it became part of the Spanish Empire. In 1821, Mexico gained its independence from Spain, and Texas became part of Mexico.
In the 1830s, a large number of American settlers moved to Texas. Tensions between the American settlers and the Mexican government grew, and in 1835, the Texas Revolution began. In 1836, Texas declared independence from Mexico and became the Republic of Texas.
In 1845, the United States annexed Texas, which led to the Mexican-American War.
The war ended in 1848 with the signing of the Treaty of Guadalupe-Hidalgo, which resulted in Mexico ceding a large amount of territory, including Texas, to the United States.