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 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 that morning, Trump had 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.'

Trump added, 'The UK giving away extremely important land is 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'.

The agreement followed a long-running dispute between the UK and Mauritius - a former British colony - about sovereignty over the Chagos Islands, which were separated from Mauritius in 1965 when it was still a British colony.

Under the deal, the UK would hand over sovereignty of the islands to Mauritius, while retaining control of Diego Garcia, leasing it back for a period of 99 years.

Despite current criticisms, the UK government insists that the deal secures operations and maintains military capabilities crucial for regional security.

Political repercussions from Trump's comments have varied, with leaders across the UK expressing their views on the perceived implications for national security and the relationship with the US.