section_path: History/Independence from Spain and Portugal
section_name: Independence from Spain and Portugal
paragraph_text: Independence from Spain and Portugal
  
  The European Peninsular War (1807–14), a theater of the Napoleonic Wars, changed the political situation of the Spanish and Portuguese colonies. First, Napoleon invaded Portugal, but the House of Braganza avoided capture by escaping to Brazil. Napoleon captured King Ferdinand VII of Spain, and appointed his own brother instead. This appointment provoked popular resistance, which created Juntas to rule in the name of the captured king.
  
  Many cities in the Spanish colonies, however, considered themselves equally authorized to appoint local Juntas like those of Spain. This began the Spanish American wars of independence between the patriots, who promoted such autonomy, and the royalists, who supported Spanish authority over the Americas. The Juntas, in both Spain and the Americas, promoted the ideas of the Enlightenment. Five years after the beginning of the war, Ferdinand VII returned to the throne and began the Absolutist Restoration, as the royalists got the upper hand in the conflict.
  
  The independence of South America was secured by Simón Bolívar (Venezuela) and José de San Martín (Argentina), the two most important Libertadores. Bolívar led a great uprising in the north, then led his army south towards Lima, the capital of the Viceroyalty of Peru. Meanwhile, San Martín led an army across the Andes Mountains, along with Chilean expatriates, and liberated Chile. He organized a fleet to reach Peru by sea, and sought the military support of various rebels from the Viceroyalty of Peru. In 1822 the two men met at the Guayaquil Conference in Ecuador, where they failed to agree on governance strategies for the liberated nations. Two years later Bolívar's forces beat the Spanish at the Battle of Ayacucho, securing the independence of Peru and the rest of South America.
  
  In the Portuguese Kingdom of Brazil, Dom Pedro I (also Pedro IV of Portugal), son of the Portuguese King Dom João VI, proclaimed the independent Kingdom of Brazil in 1822, which later became the Empire of Brazil. Despite the Portuguese loyalties of garrisons in Bahia, Cisplatina and Pará, independence was diplomatically accepted by Portugal in 1825, on condition of a high compensation paid by Brazil mediated by the United Kingdom.