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
Jaime Miguel de Guzmán de Avalos y Spinola, Marquis of la Mina, Duke of Palata and Prince of Masa Fernando Castle in Figueras and the reconstruction of the Montjuich fortress. He was buried in the Barceloneta "San Miguel del Puerto Church", an area much decayed along the times but now flourishing again after the 1992 Barcelona Olympic Games. At his death in Barcelona he was replaced by Irish-Spanish General Bernardo O´Connor. Jaime Miguel de Guzmán de Avalos y Spinola, Marquis of la Mina, Duke of Palata and Prince of Masa Jaime de Guzmán y Spinola, II Marquis of la Mina (1690–1767) was a Spanish Army commander and Captain General of Catalonia. He was also the Fifth Count of Pezuela