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 and 9 artillery pieces could not deal with the 5,100 royalists and 23 artillery pieces and had to escape with about 1,000 casualties, while the royalists only counted 32 dead. Objectives were not met and the provinces were left surrounded by potential enemies. British and French could arrive by sea, Portuguese from the East and Spaniards from the North. Had they conquered Upper Perú, the biggest threat, the royalists, would have been ended. In January 1816, Lieutenant Colonel Gregorio Aráoz de Lamadrid was sent to the north, but on 31 January was defeated at Culpina. On 2 February he won