The United Nations General Assembly dealt Britain an embarrassing defeat on Wednesday in a protracted dispute over the Chagos Islands in the Indian Ocean, demanding that the British surrender the archipelago — home to an important American military base — to Mauritius, a former British colony.

In a diplomatic showdown that underscored challenges to Britain’s influence in parts of the world where, in a bygone era, it had commanded enormous power and territorial reach, the General Assembly voted 116 to 6 for the resolution, which said the British should withdraw their “colonial administration” from the Chagos Islands within six months.

The United States was among the opponents of the resolution, which is nonbinding and cannot be enforced. But it carries important weight as a barometer of world opinion.

Britain’s ambassador to the world body, Karen Pierce, who had implored General Assembly members to defeat the resolution, said her country had no plan to abandon the islands but that it was “disappointed by the results.”