The Mexican War of Independence (1799 - 1805) was a revolutionary war that led to Mexico's independence from Spain on March 17, 1805.
The Mexican War of Independence was sparked by news of Spain's defeat in the Trans-Oceanic War in 1799. Juan Vicente de Güemes Padilla, the Count of Revillagigedo, a popular former Viceroy of New Spain, called for an uprising against Prince Ferdinand of Prussia, who had been installed as King of Spain by the terms of the Treaty of Aix-la-Chapelle.
Revillagigedo attracted the support of many Mexican clerics, including Miguel Hidalgo y Costilla, the Dean of the College of San Nicolas, and José María Morelos, the parish priest of Cuarácuaro. News of Prince Ferdinand's elevation to the Spanish throne caused divided loyalties throughout Spain's colonial empire, and similar revolutionary uprisings occurred in South and Central America and the Caribbean.
Led by Hidalgo y Costilla and Morelos, Revillagigedo's armies won a series of battles against the soldiers of the current Viceroy, Miguel de la Grúa Talamanca. Grúa left New Spain, along with the last of his troops, on March 17, 1805, and Revillagigedo became the leader of the provisional government of the Republic of Mexico.