War of the Confederation The War of the Confederation ( also known in Peru as the Chilean - Confederation war ) ( 1836 – 1839 ) , was a conflict between the Peru - Bolivian Confederation on one side and Chile , Peruvian dissidents and Argentina , on the other . The war was fought mostly in the actual territory of Peru and which ended with a Confederate defeat and the dissolution of the Confederacy . Background . The creation in 1836 of the Peru - Bolivian Confederation by Marshal Andrés de Santa Cruz caused great alarm in the neighbouring countries . The potential power of this confederation aroused the opposition of Argentina and , above all , Chile , due not only to its great territorial expanse but also to the perceived threat that such a rich state signified for the area . Diego Portales , arguably the most important Chilean statesman of the 19th century , who at the time was the power behind president José Joaquín Prieto Vial , was very concerned that the new Confederacy would break the regional balance of power and even be a threat to Chilean independence , and so became immediately its enemy . But that was just one of the reasons behind the war . On a deeper level , both countries were in a heated competition for the control of the commercial routes on the Pacific ; and for the Chileans especially , whose relations with independent Peru had already been strained by economic problems centering on the rivalry between their ports of Callao and Valparaíso . For the North - Peruvians landowners also , the Confederacy was viewed as a most serious threat to their economic interests . Tariff War . The direct conflict between the two countries started with a simple tariff disagreement . In January 1835 , General Felipe Salaverry , then president of Peru , signed a Treaty of Friendship , Commerce and Navigation with Chile . When President Salaverry was replaced by General Luis Orbegoso in Peru , the treaty was declared null and void on February 14 , 1836 . In the meanwhile , the Confederacy was already taking form . In order to force Chile to renegotiate , Peru raised its tariff on Chilean wheat from 12 cents to 3 pesos - an increase of 2400 % . Chile responded by raising the tariffs on Peruvian sugar by the same amount . The hostilities started to grow until the Mexican minister ( ambassador ) to Chile offered to mediate in the conflict . Open conflict was averted for the time being . Freire Expedition . After the victory of the conservative party in the Chilean Civil War of 1829 – 1830 , former Chilean president General Ramón Freire y Serrano was exiled to Lima . He managed to obtain a small subsidy from the Confederate government to equip a frigate and try to wrestle power from the Prieto administration . The adventure was a quick failure . The sloop " Orbegoso " was captured by the frigate " Monteagudo " on July 28 , 1836 and became part of the Chilean fleet . In the meantime , Freire who had managed to capture the city of Ancud was defeated and captured himself , being sent this time to the prison - island of Robinson Crusoe . Later he was exiled in Australia . Escalation . Raid on Callao . The Freire Expedition had a secondary result . Portales decided to take the offensive and staged a surprise raid to prevent further interference by the Confederate government in Chilean internal affairs . He gave command of the small Chilean fleet to the Spanish sailor Victorino Garrido and ordered him to raid the Confederate fleet that was stationed in the port of Callao . Garrido , who arrived with the brigantine " Aquiles " on a goodwill visit , staged a silent attack on the night of August 21 , 1836 , managing to capture 3 confederate ships : the " Santa Cruz " , " Arequipeño " and " Peruviana " . Chilean declaration of war . Instead of immediately going to war , Marshal Andrés de Santa Cruz tried to negotiate with Chile . The Chilean Congress sent Mariano Egaña as plenipotentiary to negotiate a treaty based on several points : the payments of the outstanding international debts owed by Peru to Chile , the limitation of the outstanding armies , commercial agreements , compensation to Chile for the Freire Expedition , and the dissolution of the Confederation . Santa Cruz agreed to everything but the dissolution . Chile responded by declaring war on December 28 , 1836 . The international situation was not favorable to the Chilean interests . Marshal Santa Cruz and the Confederation had been diplomatically recognized by the principal world powers with interests in the region ( Great Britain , France and the United States ) , while the possible Chilean allies ( Argentina and Ecuador ) had decided to remain neutral in the conflict . Argentine declaration of war . Nonetheless , the involvement of Marshal Santa Cruz in Argentina ' s internal affairs by his continued support to the opponents of caudillo Juan Manuel de Rosas , moved this country to also declare war on May 9 , 1837 , in support of the northern province of Tucumán , which was threatened by Santa Cruz ' s forces . France supported Santa Cruz ' s war effort by imposing a naval blockade over Buenos Aires , an ill - fated attempt to remove Rosas from power . Even though Chile and Argentina were acting against the same perceived threat , both countries went to war independently , due to the intense dislike between Portales and Rosas , and both countries continued to act separately throughout the whole course of the conflict . In 1837 Santa Cruz ' s forces defeated an Argentine army sent to topple him . Assassination of Portales . The Chilean government , in order to bolster its sagging standing with public opinion ( which was opposed to a war they did not understand ) , imposed martial law and asked for ( and obtained ) extraordinary legislative powers from Congress . Early in 1837 a Court Martial Law was approved and given jurisdiction over all citizens for the duration of the war . The opposition to the Prieto administration immediately accused Portales of tyranny , and started a heated press campaign against him personally and the unpopular war in general . Political and public opposition to war immediately affected the army , fresh still from the purges of the civil war of 1829 - 1830 . On October 4 , 1837 , Coronel José Antonio Vidaurre , commander of the " Maipo " regiment , captured and imprisoned Portales while he was reviewing troops at the army barracks in Quillota . Vidaurre immediately proceeded to attack Valparaíso on the mistaken belief that public opinion opposed to the war would support him and topple the government . Rear Admiral Manuel Blanco Encalada , in charge of the defense , defeated him right outside the port at the Battle of Baron . Captain Santiago Florín , who was in charge of Portales , had him shot when he heard of the news , on October 6 , 1837 . Most of the conspirators were subsequently captured and executed . This murder , which was perceived as having been orchestrated by Marshal Santa Cruz , turned the tide of Chilean public opinion . The government derogated Martial law and the country rallied behind the government . The war became a holy cause , and Portales its martyr . First Campaign . Confederate Naval Campaign . The first stage of the war was fought at sea . Both sides tried to take control of it from the very beginning . The Confederal fleet was composed of the " Socabaya " , " Confederación " and " Congreso " and it put out to sea on November 1837 . They first attacked the Juan Fernández garrison , which they captured , liberating the prisoners there . Then they attacked the ports of Talcahuano , San Antonio , Huasco and Caldera . Chilean Expedition . In the meantime , the Chilean government was preparing an expedition to put a quick end to the conflict . On September 1837 it sent a fleet carrying a Chilean expeditionary force of approximately 2 , 800 troops under the command of Admiral Manuel Blanco Encalada . The Chilean army landed at Islay in southern Peru in October , 1837 , occupying the city of Arequipa after a long and arduous march , during which the Chileans were decimated by disease . But the invading army failed to find the local support that had been led to believe would encounter against the Confederate government . While Admiral Blanco Encalada was immersed in never - ending negotiations with the local leaders , Marshal Santa Cruz quietly surrounded the city with his army and effectively blockaded the invading army inside . Treaty of Paucarpata . Surrounded and out - manoeuvered , and following an encounter at Paucarpata with an army under the command of Santa Cruz , Admiral Blanco Encalada was forced to sign a peace treaty . The Treaty of Paucarpata was signed on November 17 , 1837 , and agreed to the devolution of all captured ships by Chile , the restoration of commercial relations between both nations , the withdrawal of all Chilean troops from Confederate territories and the payment by the Confederacy of the former Peruvian foreign debts with Chile . The Chilean troops were reembarked . When Admiral Blanco Encalada returned rather ignominiously to Valparaíso with the fleet and the army in December , 1837 , the scandal was gigantic . The Chilean government and the Chilean public opinion repudiated the treaty in indignation . Admiral Blanco Encalada as was thrown into jail and tried for high treason , together with his advisor Antonio José de Irisarri , who had refused to even return to Chile . Both were eventually acquitted , though Irisarri wisely never returned . Naval Battle of Islay . After the treaty of Paucarpata had been repudiated , the Chilean government again dispatched its fleet , composed of 5 ships ( " Aquiles " and " Arequipeño " , the corvettes " Libertad " and " Valparaíso " and the " Chilean frigate Monteagudo " ) under the command of Robert Simpson , to disrupt Peruvian commerce . On January 12 , 1838 they met a Confederate squadron near the Peruvian port of Islay , on what is known as the Naval Battle of Islay . The Confederate squadron was conformed by the " Socabaya " , " Junín " and " Fundador " under the command of commander Juan José Panizo . Simpson attacked but Panizo managed to head him off for several hours until able to escape under the cover of darkness . Both sides claimed victory , but the result was mostly a stalemate that did not affect the course of the war . Second Campaign - Chilean Army . By mid - 1838 Chile had obtained naval superiority and dispatched General Manuel Bulnes Prieto heading a Chilean army . Battle of Portada de Guías . Although their advance was delayed by harassment from small groups of Confederate forces , the Chileans were finally able to lay siege to Lima . The first encounter between the two armies was the Battle of Portada de Guías which took place right outside the city of Lima on August 21 , 1838 . The Chilean army , under the command of General Bulnes , defeated the Confederate garrison loyal to General Orbegoso . The Chilean force occupied Lima at the end of October , 1838 but abandoned it on November 3 on hearing of the approach of a large Bolivian army under General Santa Cruz . The Chileans withdrew by land and sea toward Huacho . In the meantime , the principal citizens had met and called an open congress that proclaimed General Gamarra as Provisional President of Peru . Naval Battle of Casma . On January 12 , 1839 both fleets met in a naval battle at Casma , where the French corsairs fighting on the Confederate side were defeated by Admiral Simpson ' s Chilean fleet . On that day the Chilean fleet , which was protecting the transports used to mobilize the invading Chilean army , were attacked in the port of Casma by the Confederate fleet , composed of the " Esmond " , " Mexicana " , " Arequipeño " and " Peru " , under the command of French sailor Juan Blanchet . The battle lasted for several hours until the final repulse of the Confederate fleet . During the battle Blanchet was killed and the Confederate ship " Arequipeño " was sunk , but not before the Chilean fleet had been badly battered . Nonetheless , the resounding defeat of the Confederate fleet at Casma by the smaller Chilean squadron left Chile in absolute control of the southeastern Pacific . Battle of Buin . However , Santa Cruz failed to exploit the Chilean retreat fully , despite successes in several small skirmishes culminating in the first direct encounter between the bulk of both armies at the Battle of Buin on January 6 , 1839 . This time Santa Cruz advanced on its enemies and a brief combat happened by the margins of the Santa River . The result was a major Chilean reverse , which considerably strengthened the position and the morale of the Confederate side . Battle of Yungay . Marshal Santa Cruz occupied the town of Yungay with the intention to cut the provisions and to strangle the Chilean Expedition . After the favorable Battle of Buin , Santa Cruz was trying to finish with the Chilean Expedition in order to stabilize the internal situation in the country and to avoid any more uprisings against him . Here is where the boldness of General Bulnes could be observed , when instead of retiring and looking for a more suitable position , turned around against Santa Cruz ready to attack . The Confederate army was completely ( and surprisingly ) defeated . The Battle of Yungay took place on January 20 , 1839 . In this battle , the Confederate troops , under the command of Marshal Santa Cruz , waited the Bulnes offensive well defended on the Pan de Azúcar hill , near the town of Yungay . The battle started very early on the morning and finished late in the evening . The Confederate troops had over 2 , 400 casualties ( mostly dead ) and more than 1 , 600 soldiers were made prisoners . The Chilean army had about 1 , 300 dead and 400 injured . After the battle , General Manuel Bulnes was proclaimed as Grand Marshal of Ancash by General Gamarra . Aftermath . General Bulnes again assumed the initiative . After the crushing defeat on the Confederate Army at Yungay on January 20 , the Chileans commenced a second push southward , occupying Lima for the second time in April . Santa Cruz had already fled to Ecuador , and both the war and the short - lived Peru - Bolivian Confederation now came to an end . On August 25 , 1839 General Agustín Gamarra after assuming as president of Peru , officially declared the dissolution of the Confederation and of the North and South - Peruvian Republics , and the merging of these states back into one to be called again Peru . The Confederate defeat led to the exile of Santa Cruz , first to Guayaquil , in Ecuador , then to Chile and finally to Europe , where he died . The Chilean troops also left , after having achieved the goal of dissolving the Confederation and affirmed General Gamarra as President of Peru . Nonetheless , General Gamarra decided to pursue the war against Bolivia on his own . He was not against the idea of merging Peru and Bolivia into one political unity , but against the idea of this union being led by Bolivia . He invaded this country , but the Peruvian army was decisively defeated at the Battle of Ingaví on November 20 , 1841 , where General Gamarra himself was killed . The Bolivian army under General José Ballivián then mounted a counter - offensive managing to capture the Peruvian port of Arica . Later , both sides signed a peace in 1842 , putting a final end to the war .