Indigenous peoples of Mexico
When Mexico gained independence in 1821, the casta system was eliminated as a legal structure, but racial divides remained. 
White Mexican argued about what the solution was to the "Indian Problem", that is indigenous who continued to live in communities and were not integrated politically or socially as citizens of the new republic. The Mexican constitution of 1824 has several articles pertaining to indigenous peoples. The second article of the constitution of Mexico recognizes and enforces the right of indigenous peoples and communities to self-determination and therefore their autonomy to:
Mexican–American War
Mexico obtained independence from Spain and the Spanish Empire with the Treaty of Córdoba in 1821. It briefly experimented with monarchy, but became a republic in 1824. This government was characterized by instability, leaving it ill-prepared for international conflict when war broke out only two decades later, in 1846. In the decades preceding the war, Native American raids in Mexico's sparsely settled north prompted the Mexican government to sponsor migration from the United States to the Mexican province of Texas to create a buffer. However, the newly named "Texians" revolted against the Mexican government of President/dictator Antonio López de Santa Anna, who had usurped the Mexican Constitution of 1824, in the subsequent 1836 Texas Revolution, creating a republic not recognized by Mexico, which still claimed it as part of its national territory. In 1845, the Texan Republic agreed to an offer of annexation by the U.S. Congress and became the 28th state in the Union on December 29 that year.