With respect to Peru, in 1824, Simón Bolívar achieved military victories in the battles of Junín (August 6) and Ayacucho (December 9) to the royalist troops who dominated the viceroyalty obtaining the signature of the Spanish capitulation recognized the Peruvian independence, emancipatory action initiated in 1821 by José de San Martín who declared independence and established the Republic of Peru.