Sir Keir Starmer has signed over the Chagos Islands to Mauritius after an earlier challenge was overturned, allowing the agreement to go ahead.
Speaking to journalists on Thursday afternoon, Starmer said the agreement had been "the only way" to continue uring Diego Garcia airbase in the long run.
"We had to act now," he explained, hours after a judge lifted an injunction that had previously halted the proceedings earlier this morning.
The UK was due to sign over the sovereignty of the Chagos Islands earlier today, but an eleventh-hour injunction stalled proceedings as a High Court judge heard challenges from several Chagossians.
At 2:25 am on Thursday, a judge granted "interim relief" to Bernadette Dugasse and Bertrice Pompe, British nationals born in the Chagos Islands, who argued that Chagossians had been excluded from the conversations.
Mr Justice Chamberlain dismissed the injunction at a later hearing, concluding: "The public interest and the interests of the United Kingdom would be substantially prejudiced by the grant or continuance of interim relief, and these matters provide a strong public interest reason against the continuance of interim relief."
The British government said it wouldn’t comment on legal cases but maintained that the deal “is the right thing to protect the British people and our national security."
Labour was then able to press ahead with the original agreement, despite frustration among a number of Chagossians who argued they weren’t involved with the discussions.
Bertrice Pompe, one of two women who challenged the government’s deal, told reporters that it was "a very, very sad day" but maintained: "we are not giving up".
Based on the agreement, the Chagos archipelago will now be administered by Mauritius, while the UK and US will be expected to potentially pay billions to keep using the location for military purposes.
So, what is the Chagos Islands agreement and why are people opposed to it?

What is in the Chagos Islands deal?
Sir Keir Starmer has signed a deal to cede sovereignty of the Chagos Islands to Mauritius, which had been administered alongside the archipelago until 1965.
As part of the deal to hand back sovereignty, the UK and the US would be allowed to continue military activity through an army base on one of the islands for a multi-billion pound fee.
The deal has already faced countless delays as leadership changed both in Mauritius and the US, and pushback from various players amid concerns it would give China greater hold over the region.
Despite initial challenges and recent legal challenges, the final agreement has now been reached.
Why was it halted?
The deal was halted in the early hours of Thursday morning following action by Chagossians Bernadette Dugasse and Bertrice Pompe.
Their case essentially argued against the UK government handing over sovereignty to Mauritius. Many people native to the Chagos Islands were expelled in the Sixties and Seventies by the US and UK governments as they established an airbase on Diego Garcia.
Central to the womens’ argument are concerns about Mauritius's treatment of the Chagossian people, and fears they may face challenges returning to the island as they don’t hold citizenship for Mauritius.
“Chagossians were removed from their place of birth, without their consultation, and have been treated badly for 60 years. Since then we have been struggling to understand why we have been treated so poorly by the British government,” said Ms Pompe.
“Our human rights have been stripped away. Today the British government is repeating the same mistakes which it made 60 years ago.”
She added: “All our suffering and cries to be heard have been falling on deaf ears… I want to stay British and I also want the right to return to the Chagos Islands.”
A lawyer for Ms Pompe and Ms Dugasse, said: “The Government’s attempt to give away the Chagossian’s homeland whilst failing to hold a formal consultation with the Chagossian people is a continuation of their terrible treatment by the authorities in the past.”
Who are Bertrice Pompe and Bernadette Dugasse?

Bertrice Pompe and Bernadette Dugasse were born on the Chagossian island of Diego Garcia and are also British citizens.
They are two women who challenged the recent deal, arguing that it goes against their rights and may hinder their chances of returning to the Chagos Islands.
What is Britain’s relationship with the Chagos Islands?
The Chagos Islands have a long and complicated history of colonial rule, particularly at the hands of the British.
Britain first took control of the Chagos Islands in 1814, after it gained authority over the group of islands from the French.
In 1965, the UK split the Chagos Islands from Mauritius three years before they gained independence. As a result, the Chagos Islands then became part of the British Indian Ocean Territory.
In the decades that followed, all native people born on the Chagos Islands were forcibly expelled to the Seychelles or Mauritius to make way for UK and US military base activity.
Human rights campaigners, who have called for full reparations to generations affected by the forcible displacement of islanders, argued the deal does not go far enough to address the wrongs of the past.
The expulsions are regarded as a shameful parts of Britain's modern colonial history and Chagossians have spent decades fighting to return to the islands.
The United Nations' highest court, the International Court of Justice, previously ruled the UK's administration of the territory was unlawful and must end.
A joint statement from the UK and Mauritius governments said the new deal will be subject to a treaty that will "address wrongs of the past and demonstrate the commitment of both parties to support the welfare of Chagossians".
The Foreign Office said the agreement means the status of the base will be undisputed and legally secure.
The UK has a route that allows people of Chagossian descent to apply for British citizenship.
Where are the Chagos Islands?
The chain of Indian Ocean islands are claimed by Mauritius but are actually more than 2,000km away from the African nation.
Chagos has seven atolls and around 60 islands; of these, Diego Garcia is by far the largest.
Mauritius is an island off the east coast of Madagascar, also an island, which is off the coast of south-east Africa.
Chagos archipelago is a strategic point in the Indian Ocean between Africa and India, which is why it is a useful spot for nations seeking regional influence.
Around 3,000 people live on the islands, who are mostly British and American servicemen.
Could China now develop a base?
There have been concerns raised by Labour’s political opponents that the agreement will allow China to develop influence in the area.
Former foreign secretary James Cleverly described the move as "weak, weak, weak" while former security minister Tom Tugendhat suggested it risked allowing China to gain a military foothold in the Indian Ocean.
Jonathan Powell, the prime minister's special envoy for negotiations between the UK and Mauritius, said China would not be able to develop a base in the Chagos Islands.
He said United States officials have been "intimately involved" in the negotiations, telling Times Radio: "Every single sentence and paragraph has been through an inter-agency process, all of the agencies in Washington. We've secured all of their red lines in that negotiation.
"When you come to see the detailed treaty, which is really quite long with the exchanges of letters, you'll see that this idea of a Chinese base is just hooey. It can't happen, won't happen.”

Will the UK now hand back the Falkland Islands to Argentina?
After the UK agreed to return the Chagos Islands last year, the Argentine foreign minister, Diana Mondino, said it was time to take steps for the Malvinas (as the Argentinians call the islands) to be returned.
"We welcome this step in the right direction and the end to outdated practices,” she said.
“Following the path we have already taken, with concrete actions and not empty rhetoric, we will recover full sovereignty over our Malvinas Islands.
"The Malvinas were, are and will always be Argentine."
Argentina has long wanted back the Falklands but residents of the islands voted 99 per cent in favour of remaining part of the UK in 2013.
In a statement issued last year, Falklands governor Alison Blake sought to reassure residents that Britain's commitment to the South Atlantic territory was "unwavering".
She said the historical context of the two territories was "very different".
What other territories does the UK have?
British overseas territories are listed by the government as: