Exiles of the Chagos Islands will not be able to return to their homeland, the House of Lords has ruled.
The government won its appeal against a previous court decision that had ruled in favour of 2,000 former residents of the British Indian Ocean territory.
They were evicted in the 1960s when the colony was leased to the US to build an airbase on the atoll of Diego Garcia.
Their solicitor Richard Gifford said they were in a "state of shock" at the "disappointing outcome".
Mr Gifford said: "It has been the misfortune of the Chagos islanders that their passionate desire to return to their homeland has been caught up in the power politics of foreign policy for the past 40 years."
He added that the islanders were "really shocked" at the Law Lords' decision, following as it did the unanimous opinion of seven other judges that their right of abode was "so fundamental" the government could not take it away.
Lord Hoffmann said the case's subtext was funding - the UK may have had to pay for rebuilding their community.
He said the Chagossians had understandably "shown no inclination to return to live Crusoe-like in poor and barren conditions of life".
And in light of this, he said Foreign Secretary David Miliband was "entitled to take into account" the possibility the Chagossians would call on the UK to support "the economic, social and educational advancement' of the residents".
The campaigning journalist John Pilger said the judgment was political and upheld an "immoral and illegal" act.
He added: "How could it be otherwise when the highest court in this country has found in favour of the most flagrant injustice, certainly in my lifetime?"
The Law Lords decision is the final judgement in the long-running case.
In a statement, Mr Miliband said: "It is appropriate on this day that I should repeat the government's regret at the way the resettlement of the Chagossians was carried out in the 1960s and 1970s and at the hardship that followed for some of them.
"We do not seek to justify those actions and do not seek to excuse the conduct of an earlier generation."
However, Mr Miliband said that the courts had previously ruled that fair compensation had been paid to the Chargossians and that "the UK has no legal obligation to pay any further compensation".
He added: "Our appeal to the House of Lords was not about what happened in the 1960s and 1970s. It was about decisions taken in the international context of 2004."
BBC world affairs correspondent Mike Wooldridge said the high hopes of the Chagossians would now be dashed by the ruling. He said it was likely they would take their case to the European Court of Human Rights.
In 2000, High Court judges ruled that Chagossians could return to 65 of the islands, but not to Diego Garcia.
In 2004, the government used the royal prerogative - exercised by ministers in the Queen's name - to effectively nullify the decision.
Last year, the court overturned that order and rejected the government argument that the royal prerogative was immune from scrutiny. The government had asked the Lords to rule on the issue.
A spokesman for the Chagos Islanders said in a statement before the three-to-two majority ruling: "Forty years ago, in December 1966, the Harold Wilson Labour government gave away our homeland, including Diego Garcia, which has been given to the US government to use as a military base.
"The whole Chagossian population was forcibly removed from our homes, our animals were killed and we were dumped, mainly in the slums of Mauritius. We have been treated like slaves."
The exiled residents had hoped that if the Law Lords ruling had gone in their favour, their heritage could be rebuilt around a new tourist industry.
The Chagossians will require immigration consent to visit the islands for purposes such as tending graves, but the government has made it clear that consent would be no more than a formality.