Sir Keir Starmer has signed the controversial deal to give up sovereignty of the Chagos Islands after a last-ditch High Court bid to stop it was rejected by a judge.
The Prime Minister said there was "no alternative but to act in Britain's national interest" after agreeing to hand over the British Indian Ocean Territory to Mauritius.
The deal is expected to cost the UK £101million a year.
Speaking from the UK's military headquarters, he stressed the importance of maintaining control of a UK base on the largest island, Diego Garcia.
"Almost everything we do from the base is in partnership with the US,” Sir Keir said.
“President Trump has welcomed the deal along with other allies, because they see the strategic importance of this base and that we cannot cede the ground to others who would seek to do us harm.”
He added: “If we did not agree this deal the legal situation would mean that we would not be able to prevent China or any other nation setting up their own bases on the outer islands or carrying out joint exercises near our base, we would have to explain to you, the British people and to our allies, that we'd lost control of this vital asset.
"No responsible government could let that happen.”

Sir Keir had been due to sign off on proposals at 9am on Thursday.
But the plan was derailed by a temporary injunction, granted at 2.25am on Thursday, following an intervention by Bertrice Pompe, a British woman born in the Chagos Islands who opposes the agreement.
After an emergency hearing at the High Court, which started at just after 10.30am on Thursday morning, Mr Justice Chamberlain ruled that the injunction should be lifted.
Philip Rule KC, for Ms Pompe, applied for the block on signing the deal to continue until after her legal challenge has been dealt with.
She accuses the government of failing to carry out a lawful consultation with the Chagossian people or conduct a referendum, she says it has breached equalities laws and the ECHR, and discriminated against non-Mauritian Chagossians.
James Eadie KC, for the government, opposed a continuing block, saying international relations are “in jeopardy” and complaining at the disruption caused by the late-night injunction bid.
Mr Rule claimed the government had failed to seek clauses in the deal which would protect the rights of non-Mauritian Chagossians, including resettlement and visitation.
The court heard Ms Pompe told the government in March that she was considering a legal challenge, but Mr Rule said there had been a delay in applying for Legal Aid funding due to the recent cyber attack.
He said it was “unfortunate” that the late-night emergency injunction was needed, but said the government had refused to give notice to Ms Pompe when the deal was going to be signed - a move she says would render her legal case pointless.
Mr Eadie accused Ms Pompe of “doing nothing” after the initial legal letter in March, and said the emergency court intervention had caused “jeopardy to international relations”.
“Damage has already flowed”, he said. “The proposed signing had to be co-ordinated with Mauritius ministers, dove tailing with our Secretary of State and the Prime Minister.”
He said other countries, including the US, were preparing to respond to the deal, adding: “That has been disrupted - the damage is continuing.”

Opposition parties have attacked the deal, but the Government has insisted an international legal ruling in favour of Mauritius means the handover is necessary.
Under the terms of the agreement, Britain is expected to give up sovereignty of the island territory to Mauritius, and lease back a crucial military base on the archipelago for 99 years.
Diego Garcia is home to a joint UK-US military base, used to project Western influence in the Indian Ocean.
Speaking in the the House of Commons just this week, Defence Secretary John Healey insisted the base was “essential to our security”, and the UK’s security relationship with the US.
“We’ve had to act, as the previous government started to do, to deal with that jeopardy, we’re completing those arrangements and we’ll report to the House when we can,” he added.