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
Army of the North Goyeneche and Joaquín de la Pezuela, an able and experienced soldier, had the advantage, he negotiated with Goyeneche a 40-day armistice. The Assembly in Buenos Aires and the viceroy of Peru, José Fernando de Abascal, disapproved of this agreement. The royalists attacked by surprise, disregarding the agreement, before the arrival of reinforcements at the Battle of Vilcapugio on 1 October 1813. The royalist army, commanded by brigadier Joaquín de la Pezuela and with 4,000 men and 12 pieces of artillery confronted a patriot army with a high morale composed of 3,500 men, 14 pieces of artillery and cavalry mounted mostly