Viceroyalty of Peru arrived in Lima with Antonio José de Sucre to plan the offensive. In February 1824 the royalists briefly regained control of Lima. Olañeta's Rebellion started by surprise and the entire royalist army of Upper Peru (today's Bolivia) revolted, led by Pedro Antonio Olañeta (royalist) against La Serna, the viceroy of Peru (a liberal). This broke the royal army and started a civil war in Upper Peru. Having regrouped in Trujillo, Bolívar in June led his rebel forces south to confront the Spanish under Field Marshal José de Canterac. The two armies met on the plains of Junín on August 6,
First Upper Peru campaign of Córdoba, which was already executed for his support to Liniers. This mail mentioned a royalist army led by Goyeneche advancing over Jujuy. Balcarce, who had advanced to Potosi, was defeated by Nieto in the Battle of Cotagaita, so Castelli sent two hundred men and two cannons to strengthen his forces. With these reinforcements Balcarce achieved the victory at the Battle of Suipacha, which allowed patriots to control all of Upper Peru unopposed. One of the men sent was Martín Miguel de Güemes, who would eventually lead the "Guerra Gaucha" in Salta years later. At Villa Imperial, one of the