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' and 'total weakness', months after he and senior US officials endorsed it.

In response, the UK government said 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 on Tuesday morning, Trump said: 'Shockingly, our 'brilliant' NATO Ally, the United Kingdom, is currently planning to give away the Island of Diego Garcia, the site of a vital U.S. Military Base, to Mauritius, and to do so FOR NO REASON WHATSOEVER.' He warned that it represented 'an act of GREAT STUPIDITY.'

Responding, the prime minister's official spokesman said that the US supports the deal and 'the president explicitly recognised its strength last year'. He added that it was also backed by the UK's Five Eyes allies.

Earlier, a UK government spokesperson noted that the deal was necessary as the base on Diego Garcia was under threat from prior court decisions, underscoring the need for a secure and operable military facility.

Though Trump criticized the agreement, significant figures in the UK government reaffirmed their commitment to the deal, emphasizing its strategic importance for national defense.

As the situation develops, Mauritian authorities maintain their expectation for the agreement to proceed, reinforcing their claims to the Chagos Islands based on international law.