The Bolivian–Peruvian territorial dispute was a territorial dispute between Bolivia and Peru that lasted from the former's independence in 1825 to the signing of the Polo–Bustamante Treaty in 1909.

Spanish era On November 20, 1542, in Barcelona, King Charles I of Spain ordered, by Royal Decree, the creation of the Viceroyalties of Peru and New Spain. On September 4, 1559, King Philip II created, as part of the Viceroyalty of Peru, the Real Audiencia of Charcas. Viceroy Diego López de Zúñiga y Velasco indicated the jurisdiction of this entity from the "city of La Plata with more than one hundred leagues of land around each part". Years later, new territories would be integrated, until its territory was defined "from Collao to the City of La Plata".

On August 1, 1776, the Viceroyalty of the Río de la Plata was provisionally created, segregating the Audiencia of Charcas from the Peruvian Viceroyalty, then commanded by Manuel de Guirior. In 1777, it was declared permanent, covering the current territories of Argentina, Bolivia, Uruguay, Paraguay, parts of southern Brazil and northern Chile.Porras Barrenechea 1922, p. 10.

On May 3, 1788, the Real Audiencia of Cusco was created by Royal Decree with territories that corresponded to the Audiencias of Lima and Charcas, as well as territories from the Intendancy of Puno. On February 1, 1796, with another Royal Decree, the Intendancy of Puno became dependent on the Viceroyalty of Peru; thus also the districts of Paucarcolla and Chucuito, which until then corresponded to the Audiencia de Charcas, passed to that of Cusco.Porras Barrenechea 1930, p. 24

After the May Revolution broke out in 1810, the Viceroy of Peru José Fernando de Abascal ordered, due the advance of the Junta de Buenos Aires on Córdoba de Tucumán and the Province of Charcas, the provisional annexation of those territories to the Viceroyalty of Peru.

After the abdication of Charles IV and his son Ferdinand VII, in favor of French Emperor Napoleon; government juntas were formed throughout Spanish America. Little by little, these boards loyal to Ferdinand VII were more radical in their ideas and voices began to emerge that strongly supported the break with the Peninsula.

After the wars of independence, it was proposed that the emancipated Latin American countries retain the borders of the year 1810, provisionally until the existence of a treaty, alleging the year 1810 as the last of the Spanish monarchy for the legitimate possession of their domains.

Wars of Independence On May 25, 1809, the city of Chuquisaca, then belonging to the Viceroyalty of the Río de la Plata, saw the eponymous rebellion take place that removed the president of the city's Royal Court, Ramón García de León y Pizarro, and formed a government junta. The movement, faithful in principle to King Ferdinand VII, served as a framework for the actions of the radical sectors that spread the rebellion to La Paz, both being brutally repressed by the Spanish forces.

After the deposition of the Viceroy of the Río de la Plata, Baltasar Hidalgo de Cisneros, and the assumption of the First Junta, the River Plate revolutionaries sent several expeditions to Upper Peru, in order to prevent the royalist advance on the north of the United Provinces and evict them from the Viceroyalty of Peru. However, they would be a failure: the royalists would continue to be a threat until 1825, after the battle of Ayacucho and the independence of Upper Peru.

After the failure of the expeditions to Upper Peru, José de San Martín devised a plan to make the royalist stronghold in South America independent: the Viceroyalty of Peru, after liberating Chile, heading by sea to the Peruvian coast. On August 21, 1820, the Liberating Expedition of Peru embarked in Valparaíso, arriving in Pisco on September 7. After the withdrawal of the royalist Army from Lima, the Liberation Army entered this city on July 9, 1821. On July 15, the declaration was drafted and signed, and on July 28, 1821, General José de San Martín proclaimed independence in the Plaza Mayor of Lima.Gaceta del Gobierno del Perú Independiente, 1821-08-01

Despite having proclaimed its independence, much of the territory corresponding to the newly founded Peruvian state remained under royalist rule. Given the failure of the expeditions sent to fight the Spanish, the Peruvian Congress invited Simón Bolívar, president of Gran Colombia, to consolidate the independence of Peru. After several battles, on December 9, 1824, the royalists were definitively defeated in Ayacucho, and Viceroy José de la Serna was captured. Still remaining was an effective campaign in Upper Peru, where Pedro Antonio Olañeta, a Spanish general, remained. He would later be killed in action near the town of Tumusla on April 2, 1825, during the eponymous Battle of Tumusla.

After the Ayacucho campaign, Upper Peru could choose between belonging to either Peru or Argentina. Finally, on August 6, 1825, Upper Peru, with all its provinces represented, proclaimed its independence from Spain, becoming a new country, the State of Upper Peru.

Bolivarian era Treaty of Chuquisaca

Initially, Bolívar opposed the independence of Bolivia, trying to maintain its political union with Peru.Porras Barrenechea 1926, p. 66. Sucre, on the other hand, had the idea of concluding a boundary treaty between the two nations as soon as possible, including the port of Arica for the new republic.Zarco 1896, p. 4. A similar opinion was held by the Peruvian José Faustino Sánchez Carrión, who addressed the Peruvian Congress to definitively resolve the limits between the two republics.Tudela 1909, p. 10.

Peru recognized Bolivia as a sovereign nation and sent its plenipotentiary Ignacio Ortiz de Zevallos. On November 15, 1826, he signed a treaty with the Bolivian representatives Facundo Infante and Manuel Ureullu. In that agreement, Peru and Bolivia undertook to form a league that would be called the Bolivian Federation. In addition, the coastal border was established on the Sama river, for which Peru ceded the province of Tacna, being compensated by the province of Apolobamba/Caupolicán, the town of Copacabana and paying the amount of 5,000,000 pesos to the creditors from Peru:Zarco 1896, p. 5–6.Castelar 1902, p. 104–116.

The treaty was ratified by the Bolivian congress, but the Peruvian government, led by Andrés de Santa Cruz, did not approve it.Zarco 1896, p. 7.Porras Barrenechea 1926, p. 67

1828 Peruvian–Bolivian War

On September 1, 1826, Bolívar withdrew from Peru. His influence in the country would definitively end on January 26 of the following year, with the uprising of the Colombian troops stationed in Lima, who would definitively return to their homeland months later.

However, Peru saw its independence threatened by the imminent war with Gran Colombia. Surrounded by the Colombian Army from the north and from the south in Bolivia, the Peruvian Army was not in an advantageous situation. However, the altiplano country already had seen clashes with the Colombians. President Sucre himself suffered an attack that injured him in the head and in the right arm.

Peruvian General Agustín Gamarra and his army entered Bolivia on May 1, 1828, with the "manifest intention" of "saving that country from the threat of anarchy" and protecting Sucre's life, although his real motive was to expel the Colombians and put an end to the Bolivarian predominance in said country, counting on the support of sectors of the Bolivian population. He met no resistance and triumphantly entered La Paz.Porras Barrenechea 1926, p. 25.

On July 6, 1828, a treaty was signed between generals Agustín Gamarra and José María Pérez de Urdininea, by which it was agreed, among other things, the withdrawal of the Gran Colombian troops from Bolivia and the resignation of the presidency by Sucre.

Gran Colombia–Peru War

After the fall of Sucre in Bolivia, Gran Colombia declared war on Peru on May 3, 1828. Several confrontations took place, culminating in the Battle of Cruces, which led to the Peruvian occupation of Guayaquil and the Battle of Tarqui. With the signing of the Treaty of Guayaquil, the conflict ended.Basadre 2005, Vol. 1, p. 286.

Boundary negotiations and treaties Ferreyros–Olañeta Negotiations With distrust present and the belief that a Colombian danger was still latent, Peru sought an alliance with Bolivia and a boundary agreement, entrusting the negotiations to in La Paz and Manuel Bartolomé Ferreyros, who dealt with Casimiro Olañeta in Arequipa. They failed.Zarco 1896, p. 8.Porras Barrenechea 1926, p. 67. Shortly thereafter, Gran Colombia was dissolved.

Treaty of Tiquina

With Gran Colombia now dissolved, and the threat perceived by Peru regarding its northern neighbour having come to an end, the tensions between Peru and Bolivia increased with the rivalries between Agustín Gamarra and Andrés de Santa Cruz, caudillos in both countries, respectively.

With the failure of the negotiations between Ferreyros and Olañeta, a war between both states was now imminent. However, between the Peruvian Pedro Antonio de La Torre and the Bolivian Miguel María de Aguirre, a preliminary peace agreement was reached in Tiquina on August 25, 1831, that prevented such a situation.Castelar 1902, p. 119.

The treaty was then ratified in Lima by the Peruvian Congress on September 14 of the same year.

Treaty of Arequipa

Despite the Tiquina agreement, there was still rivalry between the two caudillos. However, thanks to the mediation of the Chilean plenipotentiary in Peru, Miguel de Zañartu, the Treaty of Arequipa was signed on November 18, 1831, with the same protagonists of the Treaty of Tiquina.

In this treaty, peace was assured between the two states and it was agreed to reduce Peru's army to 3,000 men and Bolivia's to 1,600. Neither of the two countries would intervene in the internal affairs of the other. The limits would be set by a mixed commission that would draw up the plan of the border and determine the changes and compensations of territories that were agreed upon. In the meantime, the current limits would be respected.

Likewise, a trade treaty was signed, in which equal rights were approved, navigation in Lake Titicaca was declared free and some articles necessary for the industry and agriculture of both countries were exempted. This last agreement was rejected by the Bolivian Congress, negotiating a new one, which was accepted.

Peru–Bolivian Confederation

In 1835, numerous internal wars turned Peru into a chaotic country. The country's president, Luis José de Orbegoso, made a pact with Bolivian president Andrés de Santa Cruz to unite the two republics in a confederation. The new country only existed for three years, until Santa Cruz was defeated in the fields of Yungay.

Treaty of Cuzco

The question of limits would arise again after the dissolution of the Peru–Bolivian Confederation. On April 14, 1839, a preliminary peace treaty was signed in Cuzco, signed by the Peruvian minister Manuel de Mendiburu and his Bolivian counterpart Eusebio Gutiérrez. The demarcation of limits would be done taking the Desaguadero river as a starting point.Castelar 1902, p. 125-127.Porras Barrenechea 1926, p. 68.

Peruvian–Bolivian War

The new president of Peru, Agustín Gamarra, tried to annex Bolivia, an objective that cost him his life in Ingavi in 1841. The Bolivian army, under the command of José Ballivián, invaded southern Peru, from Moquegua to Tarapacá until 1842.

The Bolivian Army did not have enough troops to maintain the occupation. Peruvian regular and irregular forces attacked the over-extended Bolivians and inflicted several defeats on them. The Bolivian troops evacuated Tacna, Arica and Tarapacá in February 1842, retreating towards Moquegua and Puno. Two more defeats at Motoni (March 20) and Orurillo (April 3) forced the withdrawal of the last Bolivian forces that occupied Peruvian territory, exposing Bolivia to an other invasion.