In the 1820s, landowning empresarios led immigrants, mostly from the United States, to Texas, which was part Mexico, for cheap land. At first, the Mexican government was happy to fill the land, but most Texans soon were Americans. Mexico began to worry about losing Texas to the United States and so decided to stop all immigration from there.
To make things worse, Mexico had a new president, Antonio López de Santa Anna, who got rid of the Mexican Constitution and made himself president for life. People in several places, especially in northeastern Mexico, joined together to fight him and the Mexican Army and to secede from Mexico.
Most Texans wanted independence; one reason was that they refused to accept an 1829 Mexican law that banned slavery. Many from the Southern United States saw slavery as a way of life. They brought enslaved African Americans to work as field hands in the production of cotton, corn, and sugar.
The war in Texas lasted from October 2, 1835 to April 21, 1836. A famous battle in the war was the Battle of the Alamo in which about 200 Texans were killed. After the war, Texas was declared an independent country and called itself the Republic of Texas.
It remained an independent country for ten years. In 1845, the United States Congress voted to admit Texas as a slave state, which made it the country's 28th state. Mexico was angry and so the Mexican–American War began.