José Joaquín de Olmedo requested military aid from Greater Colombia to defend the city and to liberate the Royal Audience of Quito.
With Santa Cruz's forces and the imposed impressment, Sucre once again had about 1,200 troops though most did not have any military experience except for the Trujillo battalion, with some training, and the Mounted Grenadiers squadron of 90 veterans under the command of Lavalle.
The army left Riobamba on 28 April headed to the city of Latacunga, where they arrived on 2 May and where 200 men of the Magdalena battalion of Colonel José María Córdova, who had come from the Cauca River, were incorporated.
The royalists were in Machachi with about 2,200 infantry soldiers of Nicolás López and about 300 cavalry troops led by Colonel Tolrá covering the passes of Jalupana and La Viudita.
When he was embarking in the port of Buenaventura, a Spanish squadron appeared, sent by Juan de la Cruz Mourgeón y Achet from the current northern coast of Ecuador.
In a letter dated 24 August 1821 and addressed to San Martín, he argued that since the Venezuelan royalists, crushed in Carabobo, would soon find their end in Puerto Cabello, then resources could be destined to Thomas Cochrane's powerful Chilean squadron to transport his army.
The people of Pasto were not prepared for such a battle, and the Rifles Battalion ruthlessly perpetrated all kinds of excesses, killing more than 400 civilians, including women, the elderly, and children, and forcibly recruiting 1,300 men.
After the boost to the emancipation project of the Americas that represented José de San Martín's campaigns in the south of the continent at the end of the 1810s, the situation in the Southern Cone was extremely worrying.
The United Kingdom of Portugal, Brazil and the Algarves launched an aggressive policy of southward expansion that, due to its monarchical nature, posed a danger to the independence of the Americas and its nascent democracies.
De la Mar compromised a large portion of the army in ambitious campaigns that failed in the battles of Torata and Moquegua, leaving the Peruvian Government in a fragile military condition.
So much so that, upon learning of the victory in Pichincha, San Martín wrote to Sucre on 24 June 1822 to ask him for the return of the Santa Cruz division plus another one composed of 1,500 to 2,000 combatants, to finish off the Royal Army of Peru.
During the Seven Years' War, he organized the civic militias to raise a host of 5,000 infantry troops and 2,000 cavalry soldiers to protect the Spanish territories from potential attacks by the English or the Portuguese.
Finally, there was the Navy: the frigate Protector; the corvettes Limeña and O'Higgins; the brigantines Belgrano, Balcarce, and Nancy; and schooners Cruz, Castelli, and Macedonia, totaling 126 cannons and 642 crew members.
[23] In an attempt to fulfill his promises, Bolívar asked Santander to send 3,000 soldiers on 29 October 1822 and on 15 April 1823.He also could not leave unguarded the provinces of Loja, Cuenca, Quito, Pasto, and even Guayaquil, where support for the royal cause was still strong and there could be uprisings.
Upon the arrival of the first Colombian expedition to the port of El Callao (3,000 troops, including Venezuelan lancers, grenadiers from New Granada, and mercenary fusiliers from Scotland, England, Germany, Russia, and Ireland),[25] Andrés de Santa Cruz and Agustín Gamarra were in an offensive near La Paz with almost all of the Peruvian forces.
Bolívar and San Martín thought the campaign was too risky, but its proponents hoped that, with a double offensive of 8,000 soldiers, they would be able to annihilate the last royalist enclaves.
When Canterac learned of the expedition, he evacuated Lima on 16 July and headed south via Jauja and Huancavelica to halt the progress of Santa Cruz and prevent a union of the Peruvian and Colombian armies.
After 25 days of sailing against the southern current, he docked the Chimborazo in the port of El Callao on 1 September, and then entered Lima on the 10th amid great celebrations.
On 11 September, they arrived at the headquarters in Huaraz without having reached an acceptable agreement with the dissident, as he was waiting for favorable news from Santa Cruz's army and the negotiations he was carrying out with the Spaniards.
Bolivar then learned of the dissolution of Santa Cruz's army along with the alarming news that Riva Agüero was seeking an agreement with Viceroy José de la Serna.
I went out to stand in the way between Riva Agüero and the loyalists in Jauja, because this wicked man, desperate for victory, was trying to surrender his homeland to the enemy in order to gain more profit even if he is less successful.The republicans numbered 15,000 men, distributed as follows at the beginning of September: 6,000 with Santa Cruz in La Paz, 3,000 with Sucre in Arequipa, 4,000 in the outskirts of Lima, and 2,000 following Riva Agüero in Trujillo, besides the 2,000 reinforcements that were expected from Chile.
With the Colombian troops—3,000 soldiers[30]—Bolívar climbed from the coast towards the Cordillera Negra; next, through the valleys of Pativilca and the fortresses; then he crossed the Summit, and finally descended to the Callejón de Huaylas.
Riva Agüero avoided combat with the Colombian troops until 25 November, when he was removed from office along with his second in command, General Ramón Herrera, by his subordinates, who were against the former president's deals with the Spaniards.
On 5 February 1824, the soldiers of the Río de la Plata Regiment rebelled in El Callao, together with some Chilean and Peruvian units, due to delays in their payments.
A hundred of them protested the action and, under the command of José Félix Bogado, they managed to join the Liberator's army, forming a squadron that fought in Junín and Ayacucho, returning later to Buenos Aires.
At once, Bolívar ordered to take all the military and logistics corps possible out of Lima before the arrival of the Spanish Army to support the rebels in El Callao.
Meanwhile, desertions continued in several Peruvian units, and Lima, unoccupied by the Liberation Army, was occupied by the royalists on 18 June while the pro-independence garrison took refuge in El Callao.
[31] This chaotic situation in the Peruvian Government would last until 16 July, when the capital city was occupied by Sucre after the evacuation of the soldiers and supporters of royalism that had started on the first day of that month.
Sucre wanted to make a preventive attack to take Jauja and reach the Izcuchaca Valley, while Bolivar preferred to save his strength until he had received reinforcements, and thus was opposed to occupying land that they would not be able to consolidate.
Bolívar would ask the Chilean Government of Ramón Freire to send 3,000 soldiers to conquer the north of El Callao, from Supe to Huanchaco, and prevent the royalist victory in Peru, which directly affected Santiago, as he relates in a letter dated 18 January 1824.