 The feeling built up in Mexico after the occupation of Spain by the French Revolutionary Emperor Napoleon in 1808, and the 1810 "Grito de Dolores" speech by Mexican Catholic priest Miguel Hidalgo y Costilla against Spanish rule is widely recognized as the beginning of the Mexican War of Independence.In 1811, Hidalgo was executed by the Spanish militia, but his movement fought on until the establishment of the independent constitutional Mexican Empire in 1821, after the Treaty of Córdoba.The Empire was ousted and the first Mexican Republic created in 1823.