History of Peru (1841–1845)

The name of Military Anarchy (Anarquía militar) is given to the period of the republican history of Peru following the death of President Agustín Gamarra during his failed invasion of Bolivia on November 18, 1841. It was a period of chaos and political and social upheaval, where no government was consolidated.

After Gamarra's death, he was succeeded by Manuel Menéndez as constitutional president, although a number of uprisings in different parts of the country challenged his authority, leading to civil war on May 17, 1843. It ended in 1845, when Ramón Castilla was elected President of the Republic after defeating Manuel Ignacio de Vivanco.

Background
At the beginning of republican life, Peru had two serious political problems: the fragility of republican political institutions and the absence of a ruling class of power with popular support. Thanks to this situation, the country entered a period of military leadership: the characters who had fought in the war of independence believed they had the right to govern Peru.

After the Peru–Bolivian Confederation was dissolved, Agustín Gamarra was appointed President of Peru. He was in favor of uniting Bolivia and Peru, but with the predominance of the latter. Therefore, taking advantage of the chaos that prevailed in the highland country, he invaded it in 1841. The Peruvian Army quickly occupied the border areas, camping in La Paz on October 19, 1841. However, the Bolivians put aside their disputes and defeated the Peruvian army at Ingavi, where Gamarra lost his life.

Government of Menéndez (1841–1842)
After Gamarra's death, the president of the Council of State Manuel Menéndez was recognised as provisional president. However, several military leaders became involved in a struggle for power: in the north, Juan Crisóstomo Torrico; in the south, Antonio Gutiérrez de la Fuente, Domingo Nieto and Juan Francisco de Vidal; and in Arequipa, Manuel Ignacio de Vivanco. Menéndez could not maintain power, as he was deposed by Torrico.

During his presidency, he achieved the following:
 * The Bolivian army was expelled from southern Peru after the battles of Tarapacá and Battle of Motoni.
 * An amnesty decree was issued for the exiles in Chile and Bolivia to return to Peru on December 11, 1841.
 * Peace was negotiated with Bolivia and achieved through the signing of the Treaty of Puno signed on June 7, 1842.
 * The national assembly was convened to elect a new president on June 15, 1842.

Government of Torrico (1842)
On August 16, 1842, Juan Crisóstomo Torrico proclaimed himself Supreme Chief of Peru. Immediately afterwards, on August 20, Torrico went up to the mountains to confront the forces of La Fuente and Vidal, coming from Cuzco. Torrico thought they were going to Lima through Ayacucho and headed to that city. However, in Jauja he was informed that they were heading to Ica, south of Lima. Therefore, he hurriedly returned to the capital, thinking that Vidal would arrive by sea. Immediately, he traveled to Ica, where both forces clashed in Agua Santa, near Pisco, on October 17, 1842. Torrico was defeated and went into exile to Chile.

Government of Vidal (1842–1843)
In his capacity as 2nd vice president of Gamarra, Juan Francisco de Vidal assumed the presidency after defeating Torrico, on October 20, 1842. He had the support of Antonio Gutiérrez de la Fuente, carrying out his position with probity and selflessness. However, his plans were frustrated by the anarchy that still dominated the country: in Arequipa, Manuel Ignacio de Vivanco revolted against Vidal. Preferring not to continue with Peru's internal wars, he resigned his command on March 15, 1843, with Justo Figuerola assuming the presidency.

During his presidency, the debt contracted by the Peruvian State and taxed on customs was reduced. Additionally, he worked in education, at the San Fernando school and the Convictorio de San Carlos.

Government of Figuerola (1843)
On March 16, 1843, Justo Figuerola received the presidential sash from Vidal. His term barely lasted a few days and ended, according to popular tradition, when a crowd of Vivanquistas in front of his house demanded his resignation, he asked his daughter to throw the presidential sash out the window since his sleep was interrupted. While another version claims that a crowd was absent, Peruvian writer Ricardo Palma recalls the presence of a crowd in one of his Peruvian Traditions.

Government of Vivanco (1843–1844)
Manuel Ignacio de Vivanco assumed the government of Peru on April 7, 1843, establishing an ultra-conservative and aristocratic regime called the Directory, a kind of enlightened despotism, since he believed that the country would progress with the rule of order over freedom. With an ultra-personalist tone, he demanded an oath of fidelity from civilians and soldiers. Little by little, the regime's waste waned its popularity, and discontent grew. In Tacna and Moquegua, Domingo Nieto and Ramón Castilla revolted, in order to put an end to the Directory and restore the deposed Menéndez. Civil war broke out, and government forces were defeated at Pachía and San Antonio. Given this, Vivanco left Lima, an action taken advantage of by his vice president Domingo Elías to proclaim himself Head of the Nation, during the Semana Magna.

On July 22, 1844, the bloody battle of Carmen Alto took place between the forces of Vivanco and Castilla, the latter being victorious.

End
After the civil war, Castilla and Elías came to an agreement and returned power to whom it constitutionally belonged: Manuel Menéndez, but due to his precarious health, Justo Figuerola exercised power again and temporarily, from August 10 October 7. Once Menéndez was reinstated in the executive, he called elections in 1845, in which Castilla triumphed, assuming power on April 20, 1845. The government of Castilla, which lasted until 1851, marked the beginning of a period of institutional calm. and the organisation of the Peruvian State, after two decades of wars and internal convulsions, and began the period known as the Guano Era.