Image copyright Science Photo Library Image caption One of the Chagos Islands - Diego Garcia - is home to a US military base

The UN has passed a resolution demanding the UK return control of the Chagos Islands to Mauritius.

In the non-binding vote in the General Assembly in New York, 116 states were in favour and only six against, a major diplomatic blow to the UK.

Fifty-six states, including France and Germany, abstained.

Mauritius says it was forced to give up the Indian Ocean group - now a British overseas territory - in 1965 in exchange for independence.

In a statement to the BBC, the UK's Foreign and Commonwealth Office (FCO) said Britain did not recognise Mauritius' claim to sovereignty, but would stand by an earlier commitment to hand over control of the islands to Mauritius when they were no longer needed for defence purposes.

The US, Hungary, Israel, Australia and the Maldives were the states voting with the UK against the resolution.

It comes months after the UN's high court advised that the UK should leave the islands "as rapidly as possible".

UK warns of setting precedent

Analysis by Nada Tawfik, BBC News, New York

The fundamental question before the General Assembly was whether the decades-long dispute was at its heart a matter of decolonisation, or a bilateral sovereignty issue to be worked out between the UK and Mauritius alone.

The vote was decisive, with 115 countries standing with Mauritius.

Former colonies were also clear in their position. India said support for decolonisation was one of the most significant contributions that the UN had made towards the promotion of fundamental human rights.

UK ambassador to the UN Karen Pierce, along with the United States, warned that the vote would set a precedent that should be of concern to all member states with their own sovereignty disputes.

Britain purchased the Chagos Archipelago from Mauritius in 1965 for £3m, creating a region known as the British Indian Ocean Territory.

Between 1967 and 1973, it evicted the islands' entire population to make way for a joint military base with the US, which is still in place on Diego Garcia.

US planes have been sent from the base to bomb Afghanistan and Iraq. The facility was also reportedly used as a "black site" by the CIA to interrogate terrorism suspects. In 2016, the lease for the base was extended until 2036.

"The joint UK-US defence facility on the British Indian Ocean Territory helps to keep people in Britain and around the world safe from terrorism, organised crime and piracy," the FCO said.

Before Wednesday's vote, Mauritian Prime Minister Pravid Kumar Jug-Nauth told the General Assembly the forcible eviction of Chagossians was akin to a crime against humanity.

However, he said Mauritius would allow the military base to continue operating "in accordance with international law", if it were given control of the islands.

Mr Jug-Nauth said this would give the facility a "higher degree of legal certainty" for the future.

The UK has maintained that Mauritius gave up the territory freely in return for a range of benefits.

Ambassador Pierce has insisted that the issue should be resolved only by the countries involved.