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
Bernardo Vieira de Melo captain-general on November 17, 1691. On January 8, 1695, he was appointed Captain-General of Rio Grande do Norte, and on September 25, 1709 Sergeant Major of the Third of Palmares, in which position he took an active part in War of the peddlers. In November 1710, Vieira was the first to call for the creation of a Republic in Brazil, an act for which he was arrested in Recife in 1712 and shipped to Lisbon with his son, André. He died in the Limoeiro prison in 1718. Bernardo Vieira de Melo Bernardo Vieira de Melo was the first Governor of