As for how the South American colonies gained their independence, most, such as Argentina, Chile and Colombia achieved independence as a result of the Spanish American wars of independence, which had begun in 1808 following the Napoleonic occupation of Spain. These wars culminated in 1825 with the decisive Battle of Ayacucho. Brazil’s independence was a separate process, and is generally considered to have begun in 1822 when Pedro I of Brazil declared Brazil’s independence from Portugal, and to have been completed by 1825 when Portugal formally recognised Brazilian independence.