General assembly has strongly condemned the British occupation of the Indian Ocean territory.
The United Nations General Assembly has overwhelmingly demanded that Britain give up control over the Chagos Islands in the Indian Ocean within six months, dealing a diplomatic blow to Britain and the United States.
Britain, which has overseen the region since 1814, detached the Chagos islands in 1965 from Mauritius - a colony that gained independence three years later - to create the British Indian Ocean Territory (BIOT).
It is home to a joint British and US airbase.
The UN resolution adopted on Wednesday backs a non-binding advisory opinion issued by the International Court of Justice (ICJ) in February, which found Britain had acted unlawfully in the decolonisation process and should relinquish control.
The resolution won the support of 116 countries, while 56 abstained and only Australia, Hungary, Israel and the Maldives joined Britain and the United States in voting against it.
Fifteen countries did not vote.
The UN General Assembly had requested the court's opinion in a resolution adopted in June 2017 with 94 votes in favor, 15 against and 65 abstentions.
The Hague-based institution is the top United Nations court for inter-state disputes.
UN General Assembly resolutions are non-binding but can carry political weight. Britain and the United States had written to all UN members to ask them to vote against the resolution.
Britain leased the Chagos archipelago's biggest island, Diego Garcia, to the United States in 1966, paving the way for construction of an airbase that required the forced removal of some 2,000 people.
"Its status as a UK territory is essential to the value of the joint U.S.-UK based on the BIOT and our shared security interests," wrote acting U.S. Ambassador to the United Nations Jonathan Cohen.
"The joint base is critical to our mutual security as well as broader efforts to ensure global security."
Diego Garcia became an important U.S. base during the Iraq and Afghanistan conflicts, acting as a launch pad for long-range bombers.
The US lease lasts until 2036. British UN Ambassador Karen Pierce said that under Britain's agreement with the United States, the islands had to remain a British territory until at least then.
Mauritius Prime Minister Pravind Kumar Juqnauth said his country was prepared to enter into an agreement with United States or Britain or both, to be allowed unhindered operation of the base.
"It is therefore difficult to understand the UK's position, unless it is one whereby Mauritius is not considered to be a trusted partner - a position which is deeply offensive to Mauritius, and to every member of the African continent," he told the General Assembly.
As part of Britain's 1965 separation agreement with Mauritius, it pledged to cede the islands when they were no longer needed for defense purposes.
Richard Gowan, International Crisis Group UN director, said Britain would never win Wednesday's vote as many member states were "very proud of the General Assembly's history of fighting colonialism during the Cold War, and see this as an extension of that legacy."
However, he added: "This vote is a symbolic blow for the UK, which sees the UN as an important vehicle for its influence after Brexit."