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
José de San Martín Freire captured Talca. Las Heras routed royalist outposts in Juncalito and Potrerillos. Bernardo O'Higgins, who came from Los Patos pass, defeated the royalists at Las Coimas. This allowed the main columns to gather at Aconcagua valley, meeting at the slopes of Chacabuco. Royalist commander Rafael Maroto converged his armies on that location as well. Maroto had 2,450 men and 5 pieces of artillery, San Martín had 3,600 men and 9 pieces of artillery. The misdirection that concealed the path of the bulk of the Army allowed San Martín this advantage, as other royalist forces were scattered in other regions of