section_path: Political and military career/Gran Colombia: 1819–1830/Ecuador, Peru, and Bolivia: 1821–1826
section_name: Ecuador, Peru, and Bolivia: 1821–1826
paragraph_text: Ecuador, Peru, and Bolivia: 1821–1826
  
  After the Battle of Carabobo, Bolívar turned his attention south, to Pasto, Colombia; Quito and the Free Province of Guayaquil, Ecuador; and the Viceroyalty of Peru. Pasto and Quito were Royalist strongholds, while Guayaquil had declared its independence on 9 October 1820 and had been garrisoned by Sucre on Bolívar's orders in January 1821. Panama declared its independence on 28 November 1821 and joined Colombia. Peru had been invaded by a Republican army led by Argentine general José de San Martín, who had liberated Chile and Peru, and Bolívar feared San Martín would absorb Ecuador into Peru. In October 1821, after congress empowered him to secure Ecuador for Colombia, Bolívar assembled an army in Bogotá that departed on 13 December 1821. His advance was halted by illness and a Pyrrhic victory at the Battle of Bomboná in southern Colombia on 7 April 1822.
  
  To the south, Sucre, who had been trapped in Guayaquil by Royalist advances from Quito, now advanced, decisively defeated the Royalists at the Battle of Pichincha on 24 May 1822, and occupied Quito. On 6 June, Pasto surrendered, and ten days later Bolívar paraded through Quito with Sucre. He also met the Ecuadorian Republican Manuela Sáenz, the wife of a British merchant, with whom he began a lasting affair. From Quito, Bolívar traveled to Guayaquil in anticipation of a meeting with San Martín to discuss the city's status and to rally support for its annexation by Colombia. When San Martín arrived in Guayaquil on 26 July, Bolívar had already secured Guayaquil for Colombia, and the two-day Guayaquil Conference produced no agreement between Bolívar and San Martín. Ill, politically isolated, and disillusioned, San Martín resigned from his offices and went into exile.
  
  Over the rest of 1822, Bolívar traveled around Ecuador to complete its annexation while dispatching officers to suppress repeated rebellions in Pasto and resisting calls to return to Bogotá or Venezuela. Meanwhile, Royalist forces under general José de Canterac overwhelmed the Peruvian republic. After initially refusing Colombian assistance, the Peruvian congress asked Bolívar several times in 1823 to assume command of their forces. Bolívar responded by sending an army under Sucre to assist, then delayed his own departure to Peru until he obtained permission from the Colombian congress on 3 August. When Bolívar arrived in Lima, Peru's capital, on 1 September, Peru was split between two rival presidents, José de la Riva Agüero and José Bernardo de Tagle, and the Royalists under the Viceroy of Peru, José de la Serna.
  
  In November 1823, Riva Agüero, who plotted with the Royalists against Bolívar, was betrayed by his officers to Bolívar and exiled from Peru. While Bolívar was bedridden with fever over the first two months of 1824, Tagle defected to the Royalists with the garrison and city of Callao and briefly took Lima. In response, the Peruvian congress named Bolívar dictator of Peru on 10 February 1824. Bolívar moved to northern Peru in March and began assembling an army. His repeated demands for additional men and money strained his relationship with Santander.
  
  In May 1823, conservative Royalist general Pedro Antonio Olañeta, based in the region of Upper Peru, rebelled against la Serna. Bolívar seized the opportunity to advance into the Junín region, where he defeated Canterac at the Battle of Junín on 6 August, driving them out of Peru. Choosing to ignore Olañeta, la Serna ordered his forces to concentrate at Cuzco to face Bolívar. Heavy rainfall in September halted Bolívar's advance, and on 6 October he gave command of the army to Sucre and moved to Huancayo to manage political affairs.
  
  On 24 October, Bolívar received a letter from Santander informing him that because he had accepted the dictatorship of Peru the Colombian congress had stripped him of his military and civil authority in favor of Sucre and Santander, respectively. Although indignant and resentful of Santander, Bolívar wrote to him on 10 November to communicate his acquiescence and reoccupied Lima on 5 December 1824. On 9 December, Sucre decisively defeated La Serna's Royalists at the Battle of Ayacucho and accepted the surrender of all Royalist forces in Peru. The garrison of Callao and Olañeta ignored the surrender. Shortly after arriving in Lima, Bolívar began a siege of Callao that lasted until January 1826, and sent Sucre into Upper Peru to eliminate Olañeta. However, Oleñeta was killed at the Battle of Tumusla prior to Sucre's arrival. With Irish volunteer Francisco Burdett O'Connor serving as his second in command, Sucre completed the liberation of Upper Peru in April 1825.
  
  In early 1825, Bolívar resigned from his offices in Colombia and Peru, but neither nation's congress accepted his resignation; on 10 February 1825, the Peruvian congress extended his dictatorship for another year. Accepting the extension, Bolívar settled into governing Peru and passing reforms that were largely not carried out, such as a school system based on the principles of English educator Joseph Lancaster that was managed by Simón Rodríguez. In April 1825, Bolívar began a tour of southern Peru that took him to the cities of Arequipa and Cuzco by August. As Bolívar approached Upper Peru, a congress gathered in the city of Chuquisaca (now Sucre); on 6 August, it declared the region to be the nation of Bolivia, named Bolívar President, and asked him to write a constitution for Bolivia. Bolívar arrived in Potosí on 5 October and met with two Argentine agents, Carlos María de Alvear and José Miguel Díaz Vélez, who tried without success to convince him to intervene in the Cisplatine War against the Empire of Brazil.
  
  From Potosí, Bolívar traveled to Chuquisaca and appointed Sucre to govern Bolivia on 29 December 1825; he departed for Peru on 1 January 1826. Bolívar arrived in Lima on 10 February and dispatched his draft of the Bolivian constitution to Sucre on 12 May. That constitution was ratified with modification by the Bolivian congress in July 1826. Peru, whose elites chafed at Bolívar's rule and the presence of his soldiers, was also induced to accept a modified version of Bolívar's constitution on 16 August. In Venezuela, Páez revolted against Santander, and in Panama, a congress of American nations organized by Bolívar convened without his attendance and produced no change in the hemispheric status quo. On 3 September, responding to pleas for his return to Colombia, Bolívar departed Peru and left it under a governing council led by Bolivian general Andrés de Santa Cruz.