FOR more than a century, Peru’s collective psyche has been scarred by its defeat in the War of the Pacific of 1879-83 and Chile’s subsequent stalling in implementing the terms of a peace treaty. So when Peru’s government asked the International Court of Justice (ICJ) in The Hague to redraw the maritime boundary between the two countries, many Peruvians saw a chance to heal wounded national pride.

In its long-awaited ruling on January 27th the court duly awarded Peru control of some 50,000 sq km of ocean but confirmed Chile’s hold over inshore waters rich in fish. The decision was arbitrary but broadly fair—less than Peru had hoped for, but less bad than Chile had feared. It offers both countries a chance to move on from the past, but only after what is likely to be months of wrangling over how to implement the ruling.

The status quo in the Pacific clearly favoured Chile. Although the coast swings northwestward at the border with Peru, forming an elbow, the previous maritime boundary ran due west (see map). Peru claimed that the 1952 treaty from which this boundary derived was merely a fishing agreement. In 2008 it asked the ICJ to rule on a threefold claim: that the boundary should run southwestward, equidistantly between each country’s coast; that it should start at Punta Concordia, where the land border meets the sea, rather than at the first boundary marker (known as Hito 1) located 200 metres inland and slightly farther north; and that Peru should be awarded an “external triangle” of international waters south of the parallel and over 200 miles from the Chilean coast. The ICJ decided by ten votes to six that in practice Peru had accepted that the parallel (running due west from Hito 1, not Punta Concordia) formed the maritime boundary for the first 80 nautical miles from the coast. Beyond that point, it stipulated a new, equidistant boundary running south-west, as Peru wanted. The two countries must agree exact co-ordinates. The upshot is to extend Peruvian waters, but only in the high seas. Most of the fish in the disputed waters—mainly Pacific pilchard and mackerel, worth more than $100m a year—will stay in Chilean waters. That was greeted with relief in Chile, whose government feared having to compensate the fishermen of Arica and Iquique for lost catches. Further out to sea, Peru will gain access to some extra swordfish, tuna and giant squid. Peruvians had come to believe they would win much more. Some were disappointed by what is a largely symbolic victory. But Ollanta Humala, Peru’s president, spoke for many when he said the ruling gave Peru “grounds for satisfaction”. Chile’s reaction was more negative. Michelle Bachelet, who takes over as president in March, described the ruling as a “painful loss”, although an aide stressed that Chile had lost none of its territorial waters (which extend for 12 nautical miles from the coast). Chilean politicians suggested that as a condition for implementing the agreement Peru should sign the International Convention on the Law of the Sea and accept the line through Hito 1 as its land border as well (losing 350 metres of beach). Peru wants swift implementation.

Many political and business leaders on both sides see the ruling as a chance to set aside the past and to intensify rapidly growing ties. Bilateral trade has grown to over $3 billion a year. Chilean companies, mainly retailers and LAN, the national airline, have invested over $13 billion in Peru. The stock of Peruvian investment in Chile is around $1 billion; more than 200 Peruvian restaurants have opened there, some of them owned by the 158,000 Peruvians who live in Chile. There is scope for more flows of capital: Peru has natural gas that Chile needs, and both countries are members of the Pacific Alliance, a free-trade block formed in 2012.

Others are watching closely. Inspired by Peru’s claim, Bolivia filed a demand at the ICJ in 2013 that Chile negotiate on its claim for sovereign access to the sea, also lost in the War of the Pacific. That claim is unlikely to prosper. But if Peru and Chile co-operate in implementing the judgment, Colombia may come under pressure to soften its refusal to apply an ICJ ruling last year that granted a swathe of Caribbean waters to Nicaragua. How one boundary is redrawn could end up affecting other maps, too.