In the nineteenth century emerged the Liberation Expedition of Peru led by the Argentine general José de San Martín with the mission of making Peru independent. On August 20, 1820, he left Valparaíso, bound for Peru, arriving in the Bay of Paracas after two weeks of navigation. A few days later, there were conversations in Miraflores (September 25) between representatives of San Martín and the viceroy Joaquín de la Pezuela, I Marqués de Viluma to seek independence in a peaceful way, but these failed.

General San Martin subsequently communicated with the intendant of Trujillo Jose Bernardo de Tagle, IV Marques de Torre Tagle who had arrived in the city that same year, by a letter dated November 20, 1820, inviting him to join the emancipating cause Bernardo de Tagle joined the patriot cause proclaiming the Independence of Trujillo on December 29, 1820. The Viceroy Pezuela resigned his office, being named as new viceroy General José de la Serna, I Count of the Andes.

La Serna proposed to San Martin new peaceful arrangements in the Punchauca Conferences, which did not reach any agreement.For this situation, the viceroy decided to evacuate Lima for fear of being exposed to the attack of San Martin, who managed to occupy the city ​​with a battalion of patriots. The acts of declaration, proclamation and swearing of the independence of Peru were carried out in the city of Lima, between the months of July and August of 1821. The first of them, constituted by the signing of the act that contained the declaration of independence, was made by the Cabildo de Lima on July 15 of that year.

The proclamation was carried out on July 28, 1821, when the leader of the Liberating Expedition of Peru, General José de San Martín, proclaimed the independence of Peru from four public squares. the swearing by the people, organized in its various institutions. On August 3, 1821, sheltering a monarchical plan, José de San Martín assumed “the political and military command of the free departments of Peru” under the title of Protector. On December 27, 1821, he summoned citizens to freely elect a Constituent Congress with the sole purpose of establishing the form of government and giving the most convenient constitution. The first Congress of the Republic of Peru met on September 20, 1822. Later, in 1824, the Venezuelan General Simón Bolívar after his victories in the battles of Junín and Ayacucho, on August 6 and December 9, 1824 respectively., accepted the capitulation of the realistic troops settled in the southern highlands, ending with the Viceroyalty of Peru.

It was Republican

Once proclaimed the independence, San Martin, assumed the political military command of the free departments of Peru, under the title of Protector, according to decree given on August 3, 1821. The works of the Protectorate contributed with the creation of the National Library (in favor of knowledge), the approval of the National Anthem, and the abolition of the mita (in favor of the indigenous). On December 27, 1821, San Martín created three ministries: Ministry of State and Foreign Affairs, committing Juan García del Río; Ministry of War and Navy, to Bernardo de Monteagudo; and Ministry of Finance, to Hipólito Unanue.

During the Protectorate, on April 7, 1822, the division of Domingo Tristán and Moscoso that traveled to Pisco, suffered a disastrous defeat of the royalist side after the battle of Ica, losing many soldiers and a large part of its armament. to accelerate the total independence of Peru in the southern highlands, San Martin traveled to Guayaquil in order to reach an agreement with Simón Bolívar, to ask for military aid, but at the end of the conference, no agreement was reached, and San Martín retired of Guayaquil with the decision to leave Peru. He gave the executive power to three of its members, who formed a collegiate body called Supreme Government Board of Peru and whose head was General José de La Mar.

The Governing Board wanted to end the War of Independence on its own and organized the First Intermediate Campaign, which ended in failure, and then Army officers revolted in the so-called Balconcillo mutiny and, with a coup d’état, dismissed the Junta and on February 28, 1823, José de la Riva Agüero was appointed President of Peru. Riva Agüero also wanted to defeat the Spaniards, who still resisted in central and southern Peru, and organized a Second Intermediate Campaign, which also ended in failure.

Then he had an open dispute with Congress and moved to Trujillo, where he installed his government, while in Lima, the Congress appointed José Bernardo de Tagle as the new President.The Congress, considering the critical situation, agreed to call Bolívar and his Liberation Army. After reunifying the command of the country, Bolivar installed his headquarters in Trujillo and organized the final campaign of Independence, with the decisive help of the Peruvians, both in soldiers, money, supplies and resources of all kinds. Junín and Ayacucho, on August 6 and December 9, 1824 respectively, were able to defeat and definitively expel from Peru the royalist troops.