Gran Colombia–Peru War was the kernel of Bolívar's grander scheme to unite the former Spanish colonies in Central and South America. Prior to becoming the titular head of Gran Colombia, Bolívar had been, briefly, the president of the newly independent state of Bolivia, his namesake. Bolivia had formerly been a part of the Viceroyalty of the "Rio de La Plata", known as Upper Peru, and, once Bolívar relinquished the presidency of Bolivia to his revolutionary compatriot, Antonio José de Sucre Alcalá, in 1826, the Peruvians saw an opportunity. Early in 1828, Peru launched a campaign against Bolivia to reclaim its former territory and
First Upper Peru campaign bulk of the royalist forces, while the center was hit by the soldiers of Pio Tristan. Many patriotic soldiers recruited at the Upper Peru surrendered or fled, and many of the recruits in La Paz switched sides during the battle. The Saavedrist Juan José Viamonte was instrumental in the defeat, by refusing to join the conflict. Although the casualties of the Army of the North were not substantial, it was left desmoralized and disbanded. The inhabitants of Upper Peru left them and welcomed the royalists back, so the army had to quickly leave those provinces. However, the resistance of Cochabamba