The International Court of Justice (ICJ) has ruled against Bolivia in its dispute with neighbouring Chile over access to the Pacific Ocean - a feud dating back to the late 19th Century.
Landlocked Bolivia lost access to the sea in 1884 after a war with Chile and has tried to regain it ever since.
The court said Chile was not obliged to negotiate granting Bolivia access.
The ruling, which comes after five years of deliberations, is final and binding.
Despite the final nature of the ruling, Bolivian President Evo Morales said "Bolivia will never give up".
Background to the dispute:
- After its defeat by Chile in the War of the Pacific, Bolivia lost 120,000 sq km of land and became a landlocked country
- Bolivia said that Chile had an obligation to "negotiate a sovereign access to the sea for Bolivia"
- It brought the territorial dispute in 2013 to the International Court of Justice in The Hague
- Chile and Bolivia have not had full diplomatic relations since 1978
Source: BBC Monitoring
Judges at the United Nations' top court did not rule on whether Chile or Bolivia had the rights to the disputed coastal stretch, it only ruled on whether Chile had an obligation to negotiate with Bolivia.
Judge Abdulqawi Ahmed Yusuf announced that the court found by 12 votes to three that Chile did not have such an obligation.
The ruling is a major setback for President Evo Morales, who was present at the court in The Hague as the ruling was read out.
As the judge dismissed Bolivia's arguments one by one, Mr Morales's face turned increasingly sombre.
The president, who has been in power since 2006, is running for a fourth consecutive term in 2019 and the issue of the access to the Pacific Ocean is an emotive issue for Bolivians.
Despite having no access to the sea, Bolivia maintains a small navy and celebrates the Day of the Sea every year.
Chilean President Sebastián Piñera has welcomed the ruling. Speaking in the capital, Santiago, he stressed that "Chile has no obligation to negotiate".
"President Morales raised false expectations among his people (...) and made us waste five years which could have been spent building a healthy relationship between the two countries," he said.
The borders between the two neighbours date back to the 1904 Treaty of Peace and Friendship, signed after Bolivia lost 400km (250 miles) of coastline to Chile during the War of the Pacific (1879-1884).
Read more about territorial disputes:
Much of Bolivia's trade passes through Chilean ports and Bolivia argued that having sovereign access to the Pacific Ocean was key to its economy and would have boosted growth.
Chile insisted that the disputed coastal stretch was sovereign Chilean territory and as such "would not be a part in anyone's negotiations".
Judge Yusuf said that he hoped that "with willingness on the part of both parties meaningful negotiations can be undertaken".