Battle of Ayacucho own. The royalists in each viceroyalty, however, took different paths. In New Spain, royalists, after defeating the insurgents, proclaimed a negotiated separation from Liberal Spain through the Plan of Iguala, which they negotiated with the remaining patriots, and the Treaty of Córdoba, which they negotiated with the new head of government, Juan O'Donojú. In Peru Viceroy Joaquín de la Pezuela was discredited after a royalist expedition to Chile under Mariano Osorio was defeated and advances in Peru were made by José de San Martín. The viceroy was overthrown on 29 January 1821, in Asnapukyu "(Aznapuquio)", in a coup by General
Republic of Texas the Isthmus of Panama (including Texas) sought independence in the Mexican War of Independence. Many Americans fought on the side of Mexico against Spain in filibustering expeditions. One of these, the Gutiérrez–Magee Expedition (also known as the Republican Army of the North) consisted of a group of about 130 Americans under the leadership of Bernardo Gutiérrez de Lara. Gutierrez de Lara initiated Mexico's secession from Spain with efforts contributed by Magee. Bolstered by new recruits, and led by Samuel Kemper (who succeeded Magee after his death in battle in 1813), the expedition gained a series of victories against soldiers led