Some Plains Indians, especially the Apache, often raided the scarcely populated towns in the northern part of Mexico, which made the immigration of great numbers of people into this region desirable for the Mexican government. Unfortunately, very few Mexicans living in the South were interested in moving to part of the country with harshest climatic conditions. Therefore, immigrants coming from the United States in search for lands to claim their own made a deal with the Mexican government: in exchange of free-of-cost lands, the colonists from the U.S. would help protect the northern territories from Apache raids, give up their U.S. citizenship and adopt the Mexican one, embrace the Catholic religion and abide by the Mexican laws.
In the U.S., the public opinion pressed the government for expanding the country westwards all the way to the East Coast arguing that Mexico neglected all the lands west of the Mississippi River and the need to provide the growing population of the U.S. (especially from foreign immigration) with lands. There was also the lobbyists of the Southern U.S. who advocated for the acquisition of lands, by means of purchase or war, in order to support their pro-slavery cause in the U.S. Congress since they were outnumbered by the anti-slavery faction.
In 1835, the change of government in Mexico from a federal to centralized type of government was met with extreme indignation across the country prompting the state of Zacatecas to secede (the Mexican Army forced its reintegration to Mexico a few months later). At this time, the Texans communicated their concerns and disagreement with the Mexican government, but the government ignored them. At the same time, the U.S. secretly offered the Texans to help within the utmost discretion. As Texans announced their independence from Mexico, the president of Mexico, Antonio Lopez de Santa Anna took personal command of an army that annihilated the small garrison of El Alamo, in San Antonio and would shortly after routed in the battle of San Jacinto. Santa Anna was taken prisoner and agreed to sign the Treaties of Velasco acknowledging the independence of Texas. However, the treaties were never ratified by the Mexican Congress and had no binding power whatsoever for the Mexican government.
The Mexican government never gave up on Texas, but for the remainder of the 1830s it was unable to stage another expedition to recover it. In 1845, the annexation of Texas by the United States enraged the public opinion in Mexico since Texas was still considered as part of Mexico. An irate message was sent to president James Polk of the U.S. demanding the return of Texas to Mexico, and as a matter of fact, both countries were just looking for the slightest excuse to go to war for Texas. A disagreement over the border between Texas (now part of the U.S.), which claimed the border on the Rio Grande, and the Mexican government, which claimed the border to the north, on Nueces River, caused the Mexicans to attack a U.S. Army detachment south of Nueces River, which the U.S. commander, General Zachary Taylor, interpreted as a <em>casus belli</em> and the commencement of hostilities between the United States and Mexico.