First Upper Peru campaign

The first Upper Peru campaign was a military campaign of the Argentine War of Independence, which took place in 1810. It was headed by Juan José Castelli, and attempted to expand the influence of the Buenos Aires May Revolution in Upper Peru (modern Bolivia). There were initial victories, such as in the Battle of Suipacha and the revolt of Cochabamba, but it was finally defeated during the Battle of Huaqui that returned Upper Peru to Royalist influence. Manuel Belgrano and José Rondeau would attempt other similarly ill-fated campaigns; the Royalists in the Upper Peru would be finally defeated by Sucre, whose military campaign came from the North supporting Simón Bolívar.

Antecedents
The Spanish king Ferdinand VII was captured and imprisoned during the Peninsular War, and the Junta of Seville took over government, claiming to govern on the absent king's behalf. There was concern about this in many Spanish overseas colonies, who thought that in the absence of the king they had the same right for self-determination as Seville. This caused the Chuquisaca Revolution and the La Paz revolution, which tried to create their own government Juntas. However, both revolutions were short-lived, and swiftly defeated by the Spanish authorities. The May Revolution, in Buenos Aires, was more successful, and ousted the viceroy Baltasar Hidalgo de Cisneros. The Primera Junta, which replaced him, prepared a military expedition to Upper Peru to secure the control of the area, while another expedition headed to Paraguay.

Before proceeding to Upper Peru, this military campaign defeated a counter revolution in Córdoba, organized by the former viceroy Santiago de Liniers. Ortiz de Ocampo disobeyed orders to execute the prisoners, sending them to Buenos Aires instead. As a result, the Junta appointed Juan José Castelli as commander of the Army of the North instead of Ocampo, and executed the prisoners on their way to Buenos Aires.

Development
Castelli was not received well in Córdoba, where Liniers was popular, but he was in San Miguel de Tucumán. In Salta, despite the formal good reception, he had difficulty obtaining troops, mules, food, money or guns. He took the political leadership of the Expedition, displacing Hipólito Vieytes, and replaced Ocampo with Colonel Antonio González Balcarce. He was informed that Cochabamba revolted in support of the Junta, but was threatened by royalist forces from La Paz. Castelli intercepted as well a mail from Nieto to Gutiérrez de la Concha, governor of Córdoba, which was already executed for his support to Liniers. This mail mentioned a royalist army led by Goyeneche advancing over Jujuy. Balcarce, who had advanced to Potosi, was defeated by Nieto in the Battle of Cotagaita, so Castelli sent two hundred men and two cannons to strengthen his forces. With these reinforcements Balcarce achieved the victory at the Battle of Suipacha, which allowed patriots to control all of Upper Peru unopposed. One of the men sent was Martín Miguel de Güemes, who would eventually lead the Guerra Gaucha in Salta years later.

At Villa Imperial, one of the richest cities of Upper Peru, an open cabildo calls Goyeneche to withdraw from their territory, which he obeys as he did not have military strength to prevail. The Bishop of La Paz, Remigio La Santa y Ortega, flees with him. Castelli is received in Potosí, where he required an oath of allegiance to the Junta and the surrender of the royalist generals Francisco de Paula Sanz and José de Córdoba y Rojas. He arranged that the operation to capture Vicente Nieto was carried out exclusively by the surviving patricians at the mines of Potosi, who had been incorporated with honors to the Army of the North. Sanz, Nieto and Córdoba were executed at the Plaza of Potosí; but Nieto claimed to die happy because it was under the Spanish flag. Goyeneche and Ortega, on the other hand, were safe on royalist land. Bernardo Monteagudo, inmate at the Jail of the Court of Chuquisaca for his participation in the revolution of 1809, escaped to join the ranks of the army. Castelli, who already knew the background of Monteagudo, appointed him his secretary.

He set up his government in Chuquisaca, where he presided over the change of regime in the entire region. He planned the reorganization of the Mines of Potosi, and a reform at the University of Charcas. He proclaimed the end of native slavery in the Upper Peru, canceling the tutelage and giving them political rights as neighbors, equal to those of the criollos. He prohibited as well the establishment of new convents and parishes, to avoid the common practice that, under the guise of spreading the Christian doctrine, the natives were forced into servitude by religious orders. He authorized free trade and redistributed land expropriated from the former workers of the mills. The decree was published in Spanish, Guarani, Quechua and Aymara; he established several bilingual schools as well. The first anniversary of the May Revolution was celebrated in Tiahuanaco with Indian chiefs, where Castelli paid tribute to the ancient Incas, encouraging people to rise against the Spanish. However, despite the welcome received Castelli was aware that most of the aristocracy supported the auxiliary army out of fear instead of genuine support. In November 1810 he sent a plan to the Junta: to cross the Desaguadero river, border between the two viceroyalties, and take control of the Peruvian cities Puno, Cuzco and Arequipa. Castelli argued that it was urgent to rise against Lima, because its economy depended largely on those districts and if they lose their power over the main royalist stronghold would be threatened. The plan was rejected as too risky, and Castelli was required to comply with the original orders. Castelli obeyed as ordered.

In December, fifty-three peninsulars were banished to Salta, and the decision was delivered for approval of the Junta. The vocal Domingo Matheu, who was associated with Tulla and Pedro Salvador Casas, arranged the annulment of the act, arguing that Castelli had acted influenced by slander and unfounded accusations. Support for Castelli began to decline, mainly due to the favourable treatment of natives and the determined opposition of the church, which attacked Castelli through his secretary Bernardo Monteagudo and his public atheism. Both royalists in Lima and Saavedra in Buenos Aires compared them both with Maximilien Robespierre, leader of the Reign of Terror of the French Revolution.

Castelli also abolished the mita in Upper Peru, a project that was shared by Mariano Moreno, but Moreno had been removed from the Junta by this point. Without Castelli being in Buenos Aires to mediate between them, the disputes between Moreno and Saavedra had worsened. The Junta requested Castelli to moderate his actions, but he went ahead with the positions he shared with Moreno. Several saavedrist officers, such as José María Echaurri, José León Domínguez, Matías Balbastro, chaplain Manuel Antonio Azcurra and the sergeant major Toribio de Luzuriaga, planned to kidnap Castelli, deliver him to Buenos Aires for trial, and give the command of the Army of the North to Juan Jose Viamonte. However, Viamonte did not accept the plan when he was informed by the conspirators, and did not attempt to carry it out. When he knew about the fate of Moreno, Castelli wrote a mail to Vieytes, Rodriguez Peña, Larrea and Azcuénaga, asking them to move to the Upper Peru. After the defeat of Goyeneche, they would march back to Buenos Aires. However, the mail was sent by the common postal service, and the postmaster of Córdoba, Jose de Paz, decided to send it instead to Cornelio Saavedra. Besides, the morenist members of the Junta had already been ousted and exiled by that point.

Defeat
The order of the Junta not to proceed to the Viceroyalty of Peru was a de facto truce that would last while not attacking Goyeneche. Castelli tried to turn the situation into a formal agreement, which would imply recognition of the Junta as a legitimate interlocutor. Goyeneche agreed to sign an armistice for 40 days until Lima was issued, and used that time to be strengthened. On 19 June, with the truce still in effect, an advanced royalist troop attacked positions at Juraicoragua. Castelli declared the truce broken and declared war on Peru.

The royalist army crossed the Desaguadero on June 20, 1811, starting the Battle of Huaqui. The Army waited near Huaqui, between the plains of Azapanal and Lake Titicaca. The patriotic left wing, commanded by Diaz Velez, faced the bulk of the royalist forces, while the center was hit by the soldiers of Pio Tristan. Many patriotic soldiers recruited at the Upper Peru surrendered or fled, and many of the recruits in La Paz switched sides during the battle. The Saavedrist Juan José Viamonte was instrumental in the defeat, by refusing to join the conflict.

Although the casualties of the Army of the North were not substantial, it was left desmoralized and disbanded. The inhabitants of Upper Peru left them and welcomed the royalists back, so the army had to quickly leave those provinces. However, the resistance of Cochabamba prevented the royalists from proceeding to Buenos Aires. Castelli moved to the post of Quirbe, and received orders to return to Buenos Aires for trial. However, upon learning of such orders they had already been replaced by others: Castelli should be confined at Catamarca, while Saavedra himself took charge of the Army of the North. Saavedra was deposed as soon as he left Buenos Aires, and confined in San Juan. The First Triumvirate, who took government by then, required Castelli to return.

Once in Buenos Aires, Castelli was in a situation of political isolation. The triumvirate and the newspaper La Gazeta accused him of defeat in Huaqui and seek punishment as deterrent. His former supporters were divided between those who joined the ideas of the Triumvirate and those no longer able to do much. Castelli suffered from tongue cancer during the long trial, which made him progressively difficult to speak, and died on October, 1812, with the trial still open.