Texas--or Tejas as the Mexicans called it--had technically been a part of the Spanish empire since the 17th century. However, even as late as the 1820s, there were only about 3,000 Spanish-Mexican settlers in Texas, and Mexico City's hold on the territory was tenuous at best. After winning its own independence from Spain in 1821, Mexico welcomed large numbers of Anglo-American immigrants into Texas in the hopes they would become loyal Mexican citizens and keep the territory from falling into the hands of the United States. During the next decade men like Stephen Austin brought more than 25,000 people to Texas, most of them Americans. But while these emigrants legally became Mexican citizens, they continued to speak English, formed their own schools, and had closer trading ties to the United States than to Mexico.
In 1835, the president of Mexico, Antonio Lopez de Santa Anna, overthrew the constitution and appointed himself dictator. Recognizing that the "American" Texans were likely to use his rise to power as an excuse to secede, Santa Anna ordered the Mexican military to begin disarming the Texans whenever possible. This proved more difficult than expected, and on October 2, 1835, Mexican soldiers attempting to take a small cannon from the village of Gonzales encountered stiff resistance from a hastily assembled militia of Texans. After a brief fight, the Mexicans retreated and the Texans kept their cannon.
The determined Texans would continue to battle Santa Ana and his army for another year and a half before winning their independence and establishing the Republic of Texas.