Peruvian Civil War of 1843–1844

Vivanco sent a division to the south of Peru under the command of his war minister, General Manuel de la Guarda, to strengthen the garrisons that already existed in that area, with the slogan of putting an end to the "factious" without hesitation.

Before continuing the march towards Tacna, both were in charge of subduing the generals Juan Crisóstomo Torrico and Miguel de San Román, who had risen up in Puno.

Nieto and Castilla, at the head of rebel militiamen from Tacna and Moquegua, lured Colonel Juan Francisco Balta, a Vivanquista chief who with a small detachment had moved away from the bulk of his army.

Attentive to this movement, Castilla advanced completely alone to the enemy camp and entered the tent of Guarda, to whom he offered to capitulate (which was only a simulation).

As a consequence of this victory, the rebellion advanced to Puno, Cuzco and Andahuaylas, thus consolidating itself throughout southern Peru, with the exception of Arequipa, which remained unwavering in its loyalty to Vivanco.

It all started when the prefect Domingo Elías, until then loyal to Vivanco, taking advantage of his departure, rose up against the Directorial government and proclaimed himself Political and Military Chief of the Republic on June 17, 1844.

Immediately afterwards, Elías organized the defense of the capital against the threat of the vivanquista forces commanded by José Rufino Echenique, who were advancing from the central Sierra.

Castilla, reinforced with the forces of Miguel de San Román, besieged Arequipa, with both parties exchanging fire for 16 days.

Vivanco, who was preceded by several parties of montoneros, positioned himself in the town of Cayma and established his defense line there, yielding the initiative to the enemy in this part.

In Carmen Alto, a small town surrounded by a plain located between Cayma and Yanahuara, the army of Castilla was deployed, sheltered by the irregularities of the terrain, and waited for the attack of its adversaries.

Dean Juan Gualberto Valdivia [es], historian of the revolutions of Arequipa, tells an anecdote about this battle: he states that Vivanco, at the time the fight broke out, was busy trying to decipher the inscription of the year in which the bell of Cayma church, a monument of historical value, had been established.

But more credible is the vivanquista version, which maintains that Vivanco was in the bell tower of that church to observe the field of operations and that he had arranged for the battle to be fought the next day, but the imprudence of one of his officers precipitated the struggle.

The next morning, Castilla entered the city and sent Dr. Juan Manuel Polar y Carasas [es] to deal with Vivanco, offering him guarantees.

The people of Arequipa, who had fervently supported Vivanco (as they would also in the civil war of 1856–1858), accepted the new order of things, given that their leader showed no interest in continuing the fight and rather fled, abandoning his troops.

Consequently, and after a brief interim period of Justo Figuerola, the President of the Council of State Manuel Menéndez resumed supreme command on October 7, 1844, with the mission of carrying out the constitutional transfer of power.

This first government of Castilla (1845-1851), meant the beginning of a stage of institutional calm and the organization of the Peruvian State, after two decades of internal conflict.