The UK must end its administration of the Chagos Islands "as rapidly as possible", the United Nations' highest court has said.
Britain forcibly evicted around 2,000 people from the Chagos Archipelago, a sovereignty in the Indian Ocean disputed by the UK and Mauritius, in the 1960s and 1970s so the United States could build a military base.
Judges at the International Court of Justice, in The Hague, said on Monday that the UK's detachment of the islands and their incorporation into the British Indian Ocean Territory was "unlawful".
The original claim of sovereignty over the islands, as Mauritius left the Commonswealth, was illegal, said the UN's Internation Court of Justice, illegal.
The UK’s ongoing administration is a "wrongful act", according to an advisory opinion given by the court, which is not binding.
The ICJ said: "The court finds that the process of decolonisation of Mauritius was not lawfully completed when that country acceded to independence and that the United Kingdom is under an obligation to bring to an end its administration of the Chagos Archipelago as rapidly as possible."
The UK agreed a package including £3 million with Mauritius for the detachment of the archipelago in 1965.
Chagossians were forcibly removed between 1967 and 1973 to make way for a US military facility on Diego Garcia, the largest island in the group.
Mauritius, which gained independence in 1968, maintains the islands are its own and Chagossians have also brought cases in British courts for the right to return.
A spokeswoman for the Foreign and Commonwealth Office said: "This is an advisory opinion, not a judgment. Of course, we will look at the detail of it carefully.
"The defence facilities on the British Indian Ocean Territory help to protect people here in Britain and around the world from terrorist threats, organised crime and piracy."
The ICJ said the opinion the UK should ends its administration was given with a majority of 13 votes to one.
Another part of its advisory opinion which said "member states are under an obligation to co-operate with the United Nations in order to complete the decolonisation" was given with the same majority.
"After recalling the circumstances in which the colony of Mauritius agreed in principle to such a detachment, the court considers that this detachment was not based on the free and genuine expression of the will of the people concerned," the ICJ said.
The resettlement of Mauritian nationals on the islands should be "addressed by the General Assembly" during the completion of decolonisation, it added.
About 2,000 people were evicted from the islands, with many resettling in Britain, Mauritius and Seychelles.
The UK has said the islands will be returned to Mauritius when the need for military facilities ends.
Rosa Curling, a solicitor with law firm Leigh Day, who represents Solange Hoareau, a Chagossian woman fighting a legal battle to return, said: "We are considering the judgment carefully with our client, but clearly the UK should stop breaching international law.
"The time has come to allow the islanders to return home," she added.