Juan José Castelli

Juan José Castelli (19 July 1764 –12 October 1812) was an Argentine lawyer who was one of the leaders of the May Revolution, which led to the Argentine War of Independence. He led an ill-fated military campaign in Upper Peru.

Juan José Castelli was born in Buenos Aires, and went to school at the Real Colegio de San Carlos in Buenos Aires and Monserrat College in the city of Córdoba, Argentina. He graduated as a lawyer from the University of Charcas, in Upper Peru. His cousin, Manuel Belgrano, introduced him to the public administration of the Viceroyalty of the Rio de la Plata. Along with Belgrano, Nicolás Rodríguez Peña, and Hipólito Vieytes, Castelli planned a revolution to replace the absolute monarchy with the new ideas of the Age of Enlightenment. He led the Buenos Aires patriots during the May Revolution, which ended with the removal of viceroy Baltasar Hidalgo de Cisneros from power. He is known as the "Speaker of the Revolution" for his speech during the open cabildo held in Buenos Aires on 22 May 1810.

Castelli was appointed a Committee member of the Primera Junta and was sent to Córdoba to end Santiago de Liniers's counter-revolution. He succeeded, and ordered the execution of Liniers and his supporters. He then commanded the establishment of a revolutionary government in Upper Peru (today's Bolivia) with the aim of freeing the indigenous peoples and African slaves. In 1811 Castelli signed a truce with the Spanish in Upper Peru, but they betrayed him and caught the Northern Army unprepared. As a result, the Argentines suffered a major loss in the Battle of Huaqui on 20 June 1811. When Castelli returned to Buenos Aires, the First Triumvirate imprisoned him for losing the battle, and Castelli died shortly afterwards from tongue cancer.

Early life and studies
Castelli was born in Buenos Aires in 1764. He was the first of eight children born to a Venetian doctor, Ángel Castelli Salomón, and Josefa Villarino, who was a relative of Manuel Belgrano. He was trained by the Jesuits shortly before their expulsion, and attended the Real Colegio de San Carlos in Buenos Aires. As was customary, one of the children of the Castelli family was ordained into the priesthood, and Juan José was chosen for this. He was sent to study at the Colegio Monserrat, part of the University of Córdoba. He was influenced by the works of Voltaire and Diderot, and especially by Jean-Jacques Rousseau's The Social Contract. He was a fellow student of men who would later have influence in the public life of South America, including Saturnino Rodríguez Peña, Juan José Paso, Manuel Alberti, Pedro Medrano, and Juan Martínez de Rozas, among others. He focused on studying philosophy and theology, but when his father died in 1785, he abandoned his career in the priesthood, for which he felt no strong vocation.

Rejecting his mother's proposal of sending him to study in Spain at the University of Salamanca and Alcalá de Henares, alongside his cousin Manuel Belgrano, he enrolled in jurisprudence studies in the University of Chuquisaca, in the Upper Peru (modern Bolivia). There, he learned about the ongoing French Revolution, and the new ideas of the Age of Enlightenment. He also learned about the 1782 Rebellion of Túpac Amaru II and the oppression of the indigenous peoples, which influenced his actions in his future Upper Peru campaign. Before returning to Buenos Aires, he visited Potosí and witnessed the use of slave labor in the mines.

Castelli returned to Buenos Aires and established a legal firm in his family home. He represented the University of Córdoba in various causes, as well as his uncle, Domingo Belgrano Peri. Through his associations with Saturnino Rodríguez Peña, he also met and befriended his brother, Nicolás Rodríguez Peña, and his associate, Hipólito Vieytes. Castelli married María Rosa Lynch in 1794, and they had seven children: Angela, Pedro, Luciano, Alejandro, Francisco José, and Juana.

Like many other nineteenth century Argentines prominent in public life, he was a freemason.

His professional development allowed him to buy, in August and take possession on December 7, 1798, the 335-hectare farm that belonged to Bishop Azamor y Ramírez on the outskirts of the viceregal capital, in the current neighborhood of Núñez. At the beginning of 1808 he moved his house to the farm. Here he was in the neighborhood of Cornelio Saavedra, Juan Larrea, Miguel de Azcuénaga and José Darregueira. In this farm he had crops and a brick factory.

Acting as a colonial official
Fifteen years before the creation of the consulate, the merchants of Buenos Aires managed to constitute a Board that was formalized as a representative body or corporation on May 18, 1779.

They constituted a heterogeneous group that differed:

a) By the place of permanent residence (Spain, "golondrinas" and Buenos Aires) and,

b) By the most important activity to which they were engaged.

First political steps
The intellectuals of the viceroyalty received and secretly distributed a copy of the Declaration of the Rights of Man and of the Citizen, promulgated by the French Revolution in 1789. Meanwhile, Belgrano returned from his studies in Europe, and was appointed as Perpetual Secretary of the new Consulate of Commerce of Buenos Aires. Belgrano and Castelli shared similar ideas about the Spanish trade monopoly and the rights of the natives. Belgrano attempted to appoint Castelli as interim Secretary of the Consulate as his assistant, but faced strong opposition from the peninsular merchants, who delayed the appointment until 1796. Belgrano became ill during his stay in Europe, which forced him to take extended leaves from work, and wanted Castelli to be his successor if he resigned.

There was a similar opposition during the 1799 election of delegates to the Buenos Aires Cabildo: Castelli was elected as third Regidor, but was rejected by merchants associated with the port of Cádiz. The conflict lasted a year, until the prominent local merchant Cornelio Saavedra wrote a memorandum recommending Castelli. Viceroy Avilés finally confirmed him in office by royal decree, in May 1800. Castelli, however, rejected the post because of his high workload in the consulate. This was seen as an insult by peninsular merchants such as Martín de Álzaga, who was influential in the Cabildo.

Castelli and Belgrano backed a pair of projects from Francisco Cabello y Mesa, who had just arrived from Spain. Cabello proposed the creation of a "Patriotic, Literary and Economic Society" lodge and the publication of a newspaper. This newspaper, the first one published in Buenos Aires, was named Telégrafo Mercantil. However, both projects were short-lived: the lodge was never established and its activities were banned by royal decree, and the consulate was instructed to withdraw support for the newspaper, which was then closed. Published by Castelli, Cabello, and Belgrano (secretary of the publication), as well as José Manuel Lavardén, Miguel de Azcuénaga and Fray Cayetano Rodríguez, the Telegraph was the first journal to advance the concept of fatherland, and the first to speak of the inhabitants as "Argentines."

Nevertheless, Hipólito Vieytes released a new newspaper shortly afterwards, the Agriculture, Trade and Industry Weekly, with Castelli in the staff. The editorial staff had meetings at the house of Saturnino Rodríguez Peña, discussing ideas for technical improvements in agriculture, removal of trade restrictions, development, manufacturing, and other topics. The newspaper also published the biographies of some Founding Fathers of the United States, such as Benjamin Franklin.

Performance in journalism
One example is the “ Telegrafo Mercantil”  where  contains a poem in honor of the recently appointed viceroy Joaquín del Pino. The ideas of the enlightenment, especially practical and utilitarian knowledge to improve the quality of life, penetrated late in Spain due to isolation, traditionalist ideas and the peninsular Inquisition. It was this need to get Spain out of its growing backwardness, in the face of the development of the other European powers, that made the ministers and royal advisers transform these ideas into "state policy". The "enlightened" economic, social, administrative and political changes had to come from the top down: "All for the people but without the people." In this context, the Viceroyalty of the Río de la Plata was created in 1776; as well as the Hearing in 1785 and the Consulate of Buenos Aires in 1794. The demographic, economic and bureaucratic growth of Buenos Aires gave rise to the birth of a heterodox elite both within the Church and in the secular sectors abandoning many lawyers and other counsels. Several Spanish Americans traveled to Spain to study, such as Manuel José de Lavardén (1770–1778), Dean Gregorio Funes (1775–1779) and Manuel Belgrano (1786–1793). In 1783 the Royal College of San Carlos was inaugurated at the initiative of Viceroy Vértiz and the leadership of the reformist canon Juan Baltazar Maciel, possessor of a wide and eclectic library that members of the elite could consult. All these changes not only aimed to increase the fiscal resources of the Crown, they also improved the living conditions of the inhabitants: health through the institution of the Protomedicato in 1780, the lighting of the streets and the reuse of the printing press of the Jesuits abandoned in Córdoba which, at the beginning of 1780, was transferred by the order of Viceroy Vértiz to Buenos Aires and given property to the Casa de los Niños Foundling for the printing of government documents or cathons and primers used by the Catholic Enlightenment.

The British invasions
Rodriguez Peña introduced Castelli to Irishman James Florence Burke, who informed Castelli that the British government supported proposals published by Francisco de Miranda which aimed to emancipate the Latin American colonies from Spanish colonial rule. Unbeknownst to Castelli, Burke also working as a spy, gathering information about the Spanish colonies. Using promises of British support, Burke founded the first Latin American secret society organized for such purposes. It would henceforth be known as "party of independence", and included Castelli, Burke and major contributors of Vieytes's newspaper. Burke was eventually uncovered by Viceroy Rafael de Sobremonte and expelled from the viceroyalty, but his involvement in espionage was not disclosed to his associates.

Castelli moved to a farm in modern the Buenos Aires neighborhood of Núñez. The farm had some agriculture fields and a small brick factory. He lived next to other influential people like Cornelio Saavedra, Juan Larrea, Miguel de Azcuénaga, and attorney José Darragueira. The meetings of the secret society continued, unaffected by the departure of Burke. On 2 June 1806, Castelli's mother died, and he was still in mourning when the city learned of a British landing in Quilmes.

The "party of independence" was caught by surprise by the invasion, as the British proclaimed respect for religion, ownership, order, freedom, and trade—but made no mention concerning Miranda's ideals. They arranged an interview with the British Viscount William Carr Beresford, asking for a clarification on whether the promises of Burke were still standing. They also asked if the British government would support an independentist attempt. Beresford gave evasive answers, saying he had no instructions to that effect. He explained that with the recent death of Prime Minister William Pitt and the rise of the Whigs to power, he needed further orders.

Castelli felt that the British were either unable or unwilling to keep to the promises made by Burke, and resigned to avoid swearing allegiance to Britain. Santiago de Liniers re-captured Buenos Aires a short time later, but Saturnino Rodríguez Peña helped Beresford escape, hoping to influence an eventual second invasion to implement reforms supported by Burke and Miranda. The second British invasion, however, once again expressed nothing concerning Miranda's ideals, and Castelli eventually chose to fight against his former allies.

After the successful defense of the city in 1807, the local criollos increased their political power with their higher military role. There was a dispute between the newly appointed Viceroy, Santiago de Liniers, and the Buenos Aires Cabildo, led by Martín de Álzaga. Both attempted to take advantage of the new situation, and influence the criollos to support them. Álzaga refrained from accusing Rodríguez Peña for aiding in Beresford's escape, and Liniers kept the criollo military bodies armed.

Carlotism


Napoleon invaded Spain in 1807, starting the Peninsular War. King Charles IV of Spain abdicated in favor of his son Ferdinand VII, but Napoleon captured him and appointed his own brother, Joseph Bonaparte, as king of Spain instead, in a series of transfers of the Spanish crown known as the abdications of Bayonne. The Spanish people organized Government Juntas to resist against the French occupation, and within months the Junta Central of Seville claimed supreme authority over Spain and the colonies. This situation encouraged the Princess Charlotte of Spain to claim the regency of the Spanish American colonies.

In this context, Castelli and Álzaga plotted to oust Liniers and constitute a local government Junta, similar to those of the metropoli. This project was not shared by most of the natives or by the head of the Regiment of Patricians, Cornelio Saavedra. Manuel Belgrano proposed as an alternative to support the plans of Princess Charlotte, which were supported by Castelli and other criollos. Belgrano, who held monarchist ideas, argued that the Carlotist project would be the most practical means of achieving independence from Spain in the circumstances. On 20 September 1808, Castelli wrote a letter to Charlotte, with the signatures of Antonio Beruti, Hipólito Vieytes, Belgrano, and Nicolás Rodríguez Peña.

Charlotte rejected this support: the party of independence sought to establish a constitutional monarchy headed by Charlotte, but she preferred to retain the power of an absolutist monarchy. Consequently, she denounced the letter and organized the detention of Diego Paroissien. Paroissien, who had several letters to the criollos, was charged with high treason. Castelli was his lawyer.

Castelli won Paroissien's acquittal by invoking the doctrine of the retroversion of the sovereignty of the people, which claimed that the Spanish American lands were a personal possession of the King of Spain but not a Spanish colony. That approach was already old, and it was used to legislate in both districts, but in this context Castelli argued that neither the Council of Regency or any other power of Spain—other than the rightful King—had authority over Spanish America. Castelli said that "the will of the people of Spain is not enough to bring the Indies to obedience". Under these premises, Castelli argued successfully that the regency offered to the sister of the captive king, while not denying the legitimacy of Ferdinand VII, was not an act of treason, but a legitimate political project that should be resolved by the Spanish American people without the intervention of the peninsular Spanish.

On 1 January 1809, Martín de Álzaga rallied most peninsular battalions to Plaza de Mayo and attempted a mutiny against Liniers. A few criollos, such as Mariano Moreno, laid their hopes for independence in this attempt, but most did not. The battalions still faithful to Liniers – the Regiment of Patricians, the other criollo battalions, and the remaining peninsular ones – conquered the Plaza and ordered the mutinying forces to withdraw. Castelli supported Liniers, accusing Álzaga of independentism. Though Castelli was himself an independentist, and had also sought to remove Liniers, he opposed Álzaga for other reasons: Álzaga was hoping to maintaining the social dominance of the peninsulares over the criollos once the viceroy, who opposed his interests, was deposed. Álzaga was defeated, and the power of the criollos was increased: Sentenach and Álzaga were banished to Carmen de Patagones and the Spanish militias who attempted the coup were disbanded.

A new viceroy, Baltasar Hidalgo de Cisneros, arrived in July to replace Liniers, and the independentist group did not agree on how to react. Castelli proposed a resumption of Álzaga's idea of creating a governing Junta, but not headed by the Spanish. Belgrano insisted on the plan to appoint Charlotte as regent of a constitutional monarchy, and Rodriguez Peña proposed a military coup, with or without Liniers at the head. They finally accepted the perspective of Cornelio Saavedra, and delayed taking action until a better opportunity.

May Revolution
When the news of the fall of the Junta of Seville arrived, the group headed by Castelli and Belgrano led the process leading to the May Revolution. Castelli and Saavedra were the most important leaders of the time, and first discarded Martín Rodríguez's plan to expel Cisneros in a coup d'état. After several discussions, they decided to request an open cabildo, an emergency popular assembly. Castelli and Belgrano negotiated with the senior alcalde and nobleman, Juan de Lezica, and the procurator, Julián de Leiva. Although they convinced them, they still needed the permission of Cisneros himself, for which Castelli and Rodriguez went to his office at the Fort of Buenos Aires. Previously, Cornelio Saavedra had denied Cisneros the support of the Regiment of Patricians, on the premise that with the disappearance of the Junta of Seville—who had appointed him as viceroy—he no longer had the right to hold that position.

Cisneros was outraged by the appearance of Castelli and Rodríguez, who came armed and without an appointment. They reacted harshly and demanded an immediate reply to the request for an open cabildo. After a brief private conversation with the prosecutor, Caspe, Cisneros gave his consent. When they were leaving, Cisneros inquired about his personal safety, to which Castelli said: "Lord, Your Excellency's person and your family are among Americans, and this should reassure you". After the interview they returned to the house of Rodríguez Peña, to inform their supporters of the new situation.

Besides his oratory, Castelli is known as the "Speaker of the Revolution" because of his great activity during the "May week". The memoirs of witnesses and participants mention him at many venues, taking part in many activities. He negotiated with the Cabildo and visited the Fort several times until the viceroy gave in to the pressure. At the same time, he held secret meetings with other criollos at the house of Rodríguez Peña, planning their actions, and he harangued the criollo militias at the barracks. Cisneros himself, describing the events the Council of Regency, called Castelli "the most interested one in the novelty", i.e., in the revolution.

The open cabildo was held on 22 May 1810; it was debated whether the viceroy should continue in office, and if not, who should replace him. The first opinion was from Bishop Benito Lue y Riega, who held that Cisneros should continue and that, if all of Spain was conquered by France, peninsulars were meant to rule in the Americas. Castelli made a counter-argument, based on the doctrine of the retroversion of the sovereignty of the people that he had already employed in the defense of Paroissien. He insisted that in the absence of a legitimate authority, sovereignty should be returned to the people; they should govern themselves. The idea of dismissing the viceroy ultimately prevailed, but as Buenos Aires had no authority to decide unilaterally the new form of government, they would elect a provisional government. A congress of deputies called from all other cities would take the final decision. However, there were disputes over who should exercise the provisional government: some argued that the Cabildo should do so, and others that it should be a Junta. Castelli bowed to Saavedra's proposal to form a Junta, but with the proviso that the procurator of the Cabildo, Julián de Leiva, had a decisive vote in the appointment. By adding this proviso, Castelli sought to add the former supporters of Martín de Álzaga, such as Mariano Moreno, Domingo Matheu, and Leiva himself.

However, this power allowed Leiva to perform a maneuver that Castelli had not anticipated. Although he approved the end of Cisneros' rule as viceroy, Leiva formed a Junta with Cisneros as its president; Cisneros would stay in power. The other members of the Junta would have been two peninsulars, the priest Juan Nepomuceno Solá and the merchant José Santos Inchaurregui, and two criollos, Saavedra and Castelli. The bulk of the natives rejected the proposal: they did not accept that Cisneros should remain in power, even under a different title. They were suspicious of the intentions of Saavedra, and believed that with Castelli alone in the Junta, little or nothing could be achieved. Castelli and Saavedra resigned that same day to put pressure on Cisneros and force him to resign, and the Junta never came into power.

That same night, the criollos gathered at the home of Rodriguez Pena and compiled a list of members for a governing Junta that was presented on 25 May. Meanwhile, Domingo French, Antonio Beruti, Aparicio, Donado, and other armed men occupied the Plaza and its access points. The list included a balance of representatives from different extractions of local politics. Lezica finally reported to Cisneros that he was no longer in command, and the Primera Junta assumed power.

Castelli and Mariano Moreno led the more radical positions of the Junta. They became close friends, visiting each other daily. Julio César Chávez described them as associates, sharing projects of a deep political, social and economic revolution, based in higher freedom for the Spanish American criollos. He described them as pragmatic men, willing to reward the allies and punish the enemies of the revolution, even if it meant using capital punishments. They were called "Jacobins", comparing their actions with those of the Reign of Terror of the French Revolution, but they were not Francophiles or afrancesados. Besides this, the similarities between the revolutions at France and Buenos Aires were largely superficial.

One of the first steps of Castelli and the Junta was the expulsion of Cisneros and the judges of the Royal Audiencia, who were shipped off to Spain under the pretext that their lives were in danger.

Execution of Liniers


Upon hearing the news of the change of government, former viceroy Santiago de Liniers prepared a counter-revolution from the city of Córdoba, but Francisco Ortiz de Ocampo routed his militia and captured all the leaders in just a couple of skirmishes. The initial orders were to send them to Buenos Aires, but after their capture the Junta decided to execute them. This decision was taken in a resolution signed by all members of the Junta, excepting Manuel Alberti, because as a priest, he could not give consent to the death penalty. The measure found strong popular resistance in Córdoba, as Liniers and the governor Juan Gutierrez de la Concha were popular and the execution of a priest (Rodrigo de Orellana, another leader of the counter-revolution) was rejected as heretical. Ocampo and Chiclana decided to carry on with the original orders, and transferred the prisoners to Buenos Aires.

The Junta reconfirmed the order, but excluded the bishop of Córdoba, Rodrigo de Orellana, who was banished instead. Castelli was commissioned by the Junta to enforce the execution order. Mariano Moreno said, "Go, Castelli, and I hope you will not incur the same weakness as our general, if not yet fulfilled the determination, Larrea will go, and finally I'll go myself if necessary". Ocampo and Chiclana were demoted. Castelli's assistants were Nicolás Rodríguez Peña, elected as secretary, his former client Diego Paroissien as a campaign doctor, and Domingo French as head of the escort.

Right after finding the prisoners, he ordered and presided over their execution: the governor of Córdoba, Juan Gutiérrez de la Concha, the former Viceroy, Santiago de Liniers, former Governor Santiago Alejo de Allende, the adviser Victorino Rodríguez, and the accountant Moreno. The execution took place at Cabeza de Tigre, in the boundary between Santa Fe and Córdoba. The bishop Orellana was not shot, but was compelled to give spiritual assistance to those convicted and to witness the execution. Domingo French was commissioned to execute the verdict.

After shooting Liniers, Castelli returned briefly to Buenos Aires and met Moreno. The secretary of war congratulated him for his conduct, and appointed him as a member representing the Junta, with full power to direct the operations to La Paz. He also left a series of instructions: Castelli was to put the government in the hands of patriots, earn the native's support, and shoot president Nieto, governor Sanz, and the Bishop of La Paz, in the case of their capture. He received similar orders to capture and execute José Manuel de Goyeneche, who had already defeated the rebels of La Paz revolution (a rebellion similar to the May Revolution, which took place at La Paz, modern Bolivia). Castelli was also instructed to rescue and draft to the Auxiliary Army the Arribeños and Patricians soldiers that, under the command of Vicente Nieto, had left Buenos Aires in 1809 to suppress revolutions in Chuquisaca and La Paz. Suspicious of those soldiers, Nieto had them disarmed and sent as prisoners to the mines of Potosi, under the supervision of Francisco de Paula Sanz. More than a third of the soldiers died within a month of work in the mines.

Campaign in Upper Peru


Castelli was not well received in Córdoba, where Liniers was popular, but he was in San Miguel de Tucumán. In Salta, despite a formal good reception, he had difficulty obtaining troops, mules, food, money, or guns. He took political leadership of the expedition to Upper Peru, 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 a letter from Nieto to Gutiérrez de la Concha, governor of Córdoba, who was already executed for his support of Liniers. This letter mentioned a royalist army led by Goyeneche marching to Jujuy. Balcarce, who had advanced to Potosi, was defeated by Nieto in the Battle of Cotagaita, so Castelli sent two hundred men and two cannon to strengthen his forces. With these reinforcements, Balcarce achieved 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 called on Goyeneche to withdraw from their territory. He obeyed, as he did not have the military strength to prevail. The Bishop of La Paz, Remigio La Santa y Ortega, fled with him. Castelli was received in Potosí and requesting that the locals swear allegiance to the Junta. He also requested that the royalist generals Francisco de Paula Sanz and José de Córdoba y Rojas submit to him. He made arrangements that the operation to capture Vicente Nieto should be carried out exclusively by the surviving members of the Regiment of Patricians from the mines of Potosi, who had been incorporated with honors into the Army of the North. Sanz, Nieto, and Córdoba were executed at the Plaza of Potosí. Nieto claimed that he died 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 Monteagudo's background, appointed him his secretary.

Castelli set up his government in Chuquisaca, where he presided over the change of regime for 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 and servitude in Upper Peru, and the natives were granted political rights equal to those of the criollos. Castelli forbade the establishment of new convents and parishes to avoid the common practice that, under the guise of spreading 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. Several Indian chiefs participated in the first anniversary of the May Revolution, celebrated in Tiahuanaco, where Castelli paid tribute to the ancient Incas and encouraged the people to rise against the Spanish. Despite their welcome, however, Castelli was aware that most of the aristocracy supported the auxiliary army out of fear instead of genuine support.

In November 1810 he requested authorization from the Junta for a military operation: to cross the Desaguadero river, the border between the two viceroyalties, and take control of the Peruvian cities of 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 lost power over that area, the main royalist stronghold would be threatened. The plan was rejected as too risky, and Castelli complied with the original orders.

In December, fifty-three peninsulars were banished to Salta, and the decision was sent to the Junta for approval. The vocal Domingo Matheu, who had business associations with Tulla and Pedro Salvador Casas, arranged the annulment of the act, arguing that Castelli had been 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 the public atheism of Bernardo Monteagudo, Castelli's secretary. Both royalists in Lima and Saavedra in Buenos Aires compared them with Maximilien Robespierre, leader of the Reign of Terror of the French Revolution.

Castelli also abolished the mita in Upper Peru, a mandatory form of public service that bordered on slavery. Mariano Moreno has also wished to end the mita, but Moreno had resigned 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 that Castelli should 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 sergeant major Toribio de Luzuriaga, planned to kidnap Castelli, deliver him to Buenos Aires for trial, and give 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 Castelli knew about Moreno's resignation, he wrote a letter to Vieytes, Rodriguez Peña, Larrea, and Azcuénaga, asking them to move to Upper Peru. If they defeated Goyeneche, they planned to march back to Buenos Aires. However, the letter was sent via the common postal service, and the postmaster of Córdoba, Jose de Paz, decided to send it instead to Cornelio Saavedra. The Morenist members of the Junta had already been ousted and exiled by that point.

The Battle of Huaqui
The order of the Junta not to proceed to the Viceroyalty of Peru was a de facto truce that would last while Castelli did not attack Goyeneche's army. 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 to allow time for Lima to ratify the agreement, but he actually used the time to reinforce his army. 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 20 June 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 Upper Peru surrendered or fled, and many of the recruits from La Paz switched sides during the battle. The Saavedrist Juan José Viamonte helped ensure Castelli's defeat by refusing to join the conflict.

Although the casualties of the Army of the North were not substantial, it was left demoralized and disbanded. Goyeneche pursued the fleeing patriots, and captured Huaqui after his victory. The inhabitants of Upper Peru 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, by the time he was notified, new orders had been issued: 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 was confined to San Juan. The First Triumvirate, which had commenced governing by then, required Castelli to return.

Once in Buenos Aires, Castelli found himself in political isolation. The triumvirate and the newspaper La Gazeta blamed him for the defeat at Huaqui, and sought punishment as a deterrent. His former supporters were divided between those who supported the ideas of the Triumvirate and those no longer able to help. Castelli suffered from tongue cancer during the long trial, which made it progressively more difficult for him to speak. He died on 12 October 1812, while the trial was still underway.

Legacy
Castelli is largely ignored in the historiography of Argentina. Most historians focus instead on the disputes between Mariano Moreno and Cornelio Saavedra in the Junta, with Castelli described in passing as a supporter of Moreno. Despite his role in the May Revolution, he was not the clear leader of it, as José Gervasio Artigas was for the Cry of Asencio or Miguel Hidalgo y Costilla for the Cry of Dolores. The May Revolution was instead the result of the convergence of diverse factions that shared the desire to remove the viceroy, and different historians highlight different specific factions. Castelli is largely ignored in Bolivia as well. His support of indigenous rights—still an ongoing issue in the country—and his religious ideas strongly affect the way he is perceived there.

The most notable biography of Castelli was Castelli, el adalid de Mayo (Castelli, the champion of May), written by the Paraguayan Julio César Chaves. Andrés Rivera increased the public awareness about Castelli with the historical novel La revolución es un sueño eterno (The revolution is an eternal dream). The famous divulgator Felipe Pigna wrote a whole chapter about Castelli at the book Los mitos de la historia argentina, which was then moved to television in the documentary film Algo habrán hecho por la historia argentina.