Shaker Aamer, the last British resident to be held in Guantanamo Bay, is to be released after more than 13 years in detention without charge.
The US government formally notified the UK authorities that they would be returning the 46-year-old Saudi national to Britain, finally bringing an end to a case that had become a cause celebre.
Successive British governments had pressed for his return after he was originally cleared for release in 2007, while Boris Johnson and Jeremy Corbyn were among the prominent MPs who campaigned for his freedom.
David Cameron - who raised his case on a number of occasions with Barack Obama - was told of the decision in a telephone call with the US President Thursday.
Mr Aamer's daughter, Johina, expressed her delight that their ordeal was coming to an end, writing on Twitter: "Thank you everyone for all the support. The news hasn't hit yet. We can't believe we might finally see our Dad after 14 years."
The senior Conservative David Davis - who was among the MPs demanding his release - said it was "long overdue".
"It is brilliant news for his family, who are British citizens, very good news for him and good news for justice," he said.
Mr Aamer will not however leave Guantanamo immediately, as the US administration has to give Congress 30 days notice of his release.
A senior US defence official said the decision to return him to the UK had been approved by Defence Ashton Carter following a "thorough review" of his case and "robust security assurances" from the British Government.
British officials would not comment on the conditions surrounding his release although it is understood he will be subject to monitoring by the security services.
A Government spokesman said: "As the US has said, we have one of the most robust and effective systems in the world to deal with suspected terrorists and those suspected of engaging in terrorist related activity and we will continue to do all we can to protect people in Britain and around the world from the threat of terrorism."
Mr Aamer, who has a wife and four children living in Battersea, south London, has said he was originally seized by bounty hunters while working as a charity worker in Afghanistan in 2001 shortly after the 9/11 attacks.
He was handed over to US forces and in February 2002 he was transferred to the Guantanamo Bay facility on Cuba accused of having aided al Qaeda.
During his time in captivity his lawyers say that he was subjected to torture, with beatings and sleep deprivation, and held in solitary confinement for 360 days. In 2005, he lost half his body weight during a hunger strike.
He was described in US military files obtained by the WikiLeaks website as a "close associate of Osama bin Laden" who fought in the battle of Tora Bora. However in 2007 the allegations against were dropped and he was cleared for release.
Despite a formal request for his return by then foreign secretary David Miliband, the US authorities refused to allow him to go.
Former Guantanamo detainee Moazzam Begg, who spent almost three years in the facility, said that what he endured was "beyond comprehension" for most people in the UK.
"This will be a black page in the history of the UK and US," he said.
Mr Aamer's lawyer, Clive Stafford Smith of the Reprieve campaign group, said that he should not have to wait 30 days for release and said the Government should demand he was "on a plane tomorrow".
"British politicians may bombasticate about our 'robust and effective systems to deal with suspected terrorists' but Shaker is not and never has been a terrorist, and has been cleared by the Americans themselves for eight years," he said.