Mexican War of Independence
Prior challenges to crown rule

There is evidence that even from an early period in post-conquest Mexican history, some began articulating the idea of a separate Mexican identity, though at the time this would have occurred only among elite Creole circles. Despite these murmurings of independence, serious challenges to Spanish imperial power before 1810 were rare and relatively isolated.

One early challenge to crown authority came after the introduction of the New Laws in 1542 by Charles V, Holy Roman Emperor. Under these laws, the grants of the encomenderos were to be ended following the deaths of the current grant holders. The encomenderos ' conspiracy included Don Martín Cortés, son of Hernán Cortés, who was exiled, with other conspirators executed.

Another challenge to crown authority occurred in 1624 when elites ousted the reformist Viceroy Diego Carrillo de Mendoza, 1st Marquess of Gelves, who sought to break up crime rackets from which the elites profited and curtail opulent displays of clerical power. The viceroy was removed following an urban religious riot of Mexico City commoners in 1624 stirred up by the elites. The crowd, which was mostly Catholic, was reported to have shouted, "Long live the King! Long live Christ! Death to bad government! Death to the heretic Lutheran ! Arrest the viceroy!" The attack was specifically against Gelves, seen as a bad representative of the crown, rather than against the monarchy or colonial rule itself.

In 1642, there was a brief conspiracy to unite American-born Spaniards, blacks, Indians and castas against the Spanish crown and proclaim Mexican independence. The man seeking to bring about independendence called himself Don Guillén Lampart y Guzmán, an Irishman with the birthname William Lamport. Lamport's conspiracy was discovered, and he was arrested by the Inquisition in 1642 and executed fifteen years later for sedition. Today, there is a statue of Lamport in the mausoleum at the base of the Angel of Independence in Mexico City.

In 1692, there was a major riot in Mexico City, where a plebeian mob attempted to burn down the viceroy's palace and the archbishop 's residence. A painting by Cristóbal de Villalpando shows the damage of the tumulto. Unlike the riot in 1624, in which elites were involved and the viceroy ousted with no repercussions against the instigators, the 1692 riot was instigated by plebeians alone and had an additional racial component. The rioters attacked key symbols of Spanish power and shouted political slogans, such as, "Kill the Spaniards and the Gachupines who eat our corn! We go to war happily! God wants us to finish off the Spaniards! We do not care if we die without confession ! Is this not our land?" The viceroy attempted to address the cause of the riot, a hike in maize prices that affected the urban poor. But the 1692 riot "represented class warfare that put Spanish authority at risk. Punishment was swift and brutal, and no further riots in the capital challenged the Pax Hispanica."

Food shortages almost a century later, due to a growing population and severe droughts, led to two food riots in 1785 and 1808. The first riot was more severe, but both culminated in violence and anger at officials of the colonial regime. However, there is no direct link between these riots and the independence movement of 1810, although the 1808–1809 food shortage may have been a contributory factor for popular resentment at the political regime.

Various indigenous rebellions in the colonial era occurred but were generally local in nature, attempting to redress perceived wrongs of immediate authorities rather than throw off crown rule more broadly. They were not a broad independence movement as such. However, during the War of Independence, issues at the local level in these rural areas were so widespread as to constitute what some historians have called "the other rebellion".

Finally, before the events of 1808 upended the political situation in New Spain, there was an isolated and abortive 1799 event called the Conspiracy of the Machetes, perpetrated by a small group in Mexico City seeking independence.
length_constraints:number_paragraphs[2], keywords:forbidden_words