In the era of the Spanish American wars of independence, Huanta remained loyal to the Spanish monarch Ferdinand VII and the viceroy of Peru designated it the "Loyal and Invincible "Villa" of Huanta", a source of pride for the residents. Huanta and the province was the site of a major rebellion (1825–28) against the newly formed Peruvian state. The Huanta Rebellion, characterized as a monarchist rebellion, brought together different ethnic and occupational groups in complex interactions. The peasants of Huanta were originally monarchist rebels and were transformed into liberal guerrillas. Although the rebels were largely illiterate and considered passive and reactionary, recent research argues that they had a clear vision of national politics. The Huanta rebellion was defeated militarily, but the local leaders did not suffer the severe repression that characterized earlier rebellions, most notably the Rebellion of Túpac Amaru II.