The War of Texas Independence began as Mexico gained independence from Spain and began restricting American immigration into Texas, causing tensions to rise. In 1836, Texans declared independence from Mexico after Santa Anna abolished the Mexican constitution and raised an army. The Texans were defeated at the Alamo and Goliad but achieved victory at the Battle of San Jacinto, capturing Santa Anna. Santa Anna was forced to sign treaties recognizing Texas independence and withdrawing Mexican troops south of the Rio Grande River.