First Mexican Republic
The Spanish Empire fell apart after Napoleon's invasion of Spain and the permanent end of the Spanish Bourbons in 1808. Throughout Spain and her colonies there was a widespread refusal to recognize Napoleon's brother Joseph II as the new French-backed king of Spain. The cleric Miguel Hidalgo y Costilla, who had long been part of a circle of smart people who tried to reform the colonial system triggered the Mexican War of Independence in 1810 by accusing the Spanish ruling classes of seeking to recognize Joseph Bonaparte, while announcing loyalty to the imprisoned Ferdinand VII. The subsequent uprising would go on to seriously threaten the capital yet it was ultimately defeated within a year and Hidalgo was captured and executed.