The UK government has defended a deal to give the Chagos Islands to Mauritius and lease back a key military base, following criticism from US President Donald Trump over its handling.

In a post on social media, Trump labelled the move as an act of great stupidity, months after he and senior US officials endorsed it. Later on Tuesday he confirmed he was against the deal.

The UK government stated it would never compromise on our national security, while the Prime Minister's official spokesperson insisted the US still supported the move.

The UK signed the £3.4bn ($4.6bn) agreement in May, under which it would retain control of a UK-US military base on the largest of the islands, Diego Garcia.

In a post on his Truth Social platform, Trump criticized the UK for planning to transfer the strategically significant island to Mauritius, implying that such actions may have been noted by geopolitical rivals China and Russia.

Responding, the Prime Minister's official spokesperson noted that the administration from which Trump expressed his concerns had recognized the agreement’s strength previously. He emphasized that the Chagos deal would move forward, contrary to Trump's remarks.

The long-standing dispute over the Chagos Islands followed their separation from Mauritius in 1965, when Mauritius was still under British colonial rule. Despite Trump's recent objections, legal frameworks and international support remain in place for the agreement, reflecting its significance for both UK and US military operations in the region.

While Trump remains vocally opposed to the deal, UK officials are confident of its continued viability, citing support from Five Eyes allies. Detractors from various political factions within the UK are questioning the decision, urging a reconsideration of the government's stance on the issue.