Mexican War of Independence
The Mexican War of Independence () was an armed conflict, and the culmination of a political and social process which ended the rule of Spain in 1821 in the territory of New Spain. The war had its antecedent in Napoleon's French invasion of Spain in 1808; it extended from the Cry of Dolores by Father Miguel Hidalgo y Costilla on September 16, 1810, to the entrance of the Army of the Three Guarantees led by Agustín de Iturbide to Mexico City on September 27, 1821. September 16 is celebrated as Mexican Independence Day.
Adams–Onís Treaty
The treaty was ratified by Spain in 1820, and by the United States in 1821 (during the time that Spain and Mexico were engaged in the prolonged Mexican War of Independence). Spain finally recognized the independence of Mexico with the Treaty of Córdoba signed on August 24, 1821. While Mexico was not initially a party to the Adams–Onís Treaty, in 1831 Mexico ratified the treaty by agreeing to the 1828 Treaty of Limits with the U.S.