In the 1820s, empresarios led immigrants from the United States to Texas, which was part of Mexico, for cheap land. At first, the government thought this was good, but soon many more Americans than Mexicans lived in Texas. The leaders of Mexico began to worry that they might lose Texas to the Americans and so they decided to stop all immigration from the United States.
To make things worse, Mexico had a new president, Antonio López de Santa Anna, who threw out the Mexican constitution and made himself president for life. People in several provinces joined together to fight him and the Mexican army and secede (separate) from Mexico. Americans and Mexicans living in Texas did this. The war in Texas lasted from October 2, 1835, to April 21, 1836. A famous battle in this 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 Congress voted to admit Texas as a slave state, making Texas the country's 28th state. Mexico thought this was bad, and soon a new Mexican–American War began.