Fourth Upper Peru campaign

The Fourth Upper Peru campaign was an unsuccessful invasion in 1817 by the rebel United Provinces of the Río de la Plata, during the Argentine War of Independence, of Upper Peru (today Bolivia), which was still under control of Spanish troops.

The campaign
The war between the Patriots in Argentina and the Royalists in Upper Peru (Bolivia) had been going on for 6 years. In early November 1816, the Royalists invaded Argentina, advancing with 3,000 men under the command of Pedro Antonio de Olañeta, Juan Guillermo de Marquieguy, and Field Marshal José de la Serna.

They gained a victory at the Battle of Yavi on 15 November 1816. At the beginning of 1817, José de la Serna continued his advance on Jujuy with 5,000 men and on 17 January, the vanguard commanded by Pedro Antonio Olañeta occupied San Salvador de Jujuy and waited for de la Serna to arrive with the bulk of the army. But their advance towards the south was harassed and detained by guerrilla groups commanded by Colonel Martín Miguel de Güemes. To make matters worst, de la Serna learned that José de San Martín and his Army of the Andes had crossed the Andes into Chile and defeated the royalist army there on 12 February. This left the Viceroyalty of Peru exposed to an invasion from Chile, so he had no choise but to withdraw.

Manuel Belgrano, commander of the Army of the North of the United Provinces of the Río de la Plata sent a small military division to Upper Peru under the command of Lieutenant Colonel Gregorio Aráoz de Lamadrid with the aim of hindering the Royal Army of Peru as much as possible.

This division managed to gain a victory at the Battle of la Tablada de Tolomosa (15 April) and advance as far as Chuquisaca. But there the Patriot division was repelled and defeated at the Battle of Sopachuy (12 June) and was forced to retreat to Tucuman, pursued by three royalist divisions. Nevertheless, the objective was achieved to turn back the Royalist invasion of 1816–17.

Results
This was the fourth and last time that the Northern Army had tried to advance into Upper Peru, and again the campaign had ended in failure. The next years, Argentina descended into civil war and Upper Peru would remain under Royalist control until 1825, after the Battle of Ayacucho, won by Patriot troops from Colombia and Peru.