A British resident held at Guantanamo Bay for more than four years is expected to be flown back to the UK early next week.
The UK Foreign Secretary David Miliband said today the UK and US governments had "reached agreement" on the transfer of Binyam Mohamed.
The detainee will be returned to Britain "as soon as the practical arrangements can be made", Mr Miliband said in a statement.
Ethiopian-born Mr Mohamed, 30, has been held at the controversial US military detention centre at Guantanamo Bay on Cuba since September 2004.
He went on a hunger strike for more than a month at the start of this year and was described by his legal team as "close to starvation".
A team of British officials who travelled to Guantanamo Bay last weekend said he was well enough to travel back to the UK.
The detainee, who lived in London before his arrest in Pakistan in 2002, alleges he was tortured into falsely confessing to terrorist activities and claims MI5 officers were complicit in his abuse.
No date has been confirmed for his return to Britain, but reports suggest it could be as early as Monday.
Mr Miliband said today: "The UK and US governments have reached agreement on the transfer of Binyam Mohamed from Guantanamo Bay to the UK.
"He will be returned as soon as the practical arrangements can be made.
"This result follows recent discussions between the British and US governments and a medical assessment, undertaken by a UK doctor, that Mr Mohamed is medically fit to return."
The detainee's return to Britain does not constitute a commitment from from Home Secretary that he can remain in the UK permanently, he added.
Mr Miliband said: "His immigration status will be reviewed following his return and the same security considerations will apply to him as would apply to any other foreign national in this country.
"As always, all appropriate steps will be taken to protect national security."
Mr Mohamed claims after being detained in Pakistan he was secretly flown to Morocco and tortured before being moved to Afghanistan and then to Guantanamo Bay.
The US accused him of involvement in a radioactive "dirty bomb" plot, but all terror charges against him were dropped last year.
The Attorney General is consulting the Director of Public Prosecutions over whether to order a criminal investigation into claims that intelligence and security agents were involved in torturing him.
The torture allegations are also at the heart of an ongoing legal row after two High Court judges complained they were blocked by Mr Miliband from making public information relating to Mr Mohamed's case for national security reasons.
The US Department of Justice declined to comment on the individual case of Mr Mohamed.
A spokesman for the department said: "As a matter of policy, we do not comment on the transfer of any detainee, unless and until a transfer has actually occurred.
"A comprehensive interagency review of each of the detainees at Guantanamo is under way, and we do not want to prejudge the outcome of that review.
"However, we will undoubtedly need the assistance of our close friends and allies as we work towards closing Guantanamo."
Liberal Democrat foreign affairs spokesman Edward Davey said Mr Mohamed's release was "long overdue".
He said: "With Mr Mohamed back in the UK, the Government will have to come clean over any British role in his alleged rendition and torture.
"If Mr Mohamed's allegations are true, as is widely suspected, then he will not only be a victim of illegal rendition and torture, but a crucial witness to a grave crime and a damaging cover-up by the American Government and possibly the British Government too.
"The Attorney General has a huge responsibility on her shoulders.
"There can be no political influence into the direction of this investigation. Britain's international reputation is on the line. The only way we can move forward is through open justice."
Mr Mohamed's lawyer, Clive Stafford Smith, director of legal charity Reprieve, welcomed the news.
He said: "This is truly wonderful news for Binyam Mohamed, who wants nothing more than to return to normal life in Britain.
"The Foreign Office have worked long and hard to secure Binyam's release from Guantanamo Bay. We thank them for their efforts on Binyam's behalf and to those in the Obama administration who assisted them."
Amnesty International called on the Government to press for the release of other Guantanamo Bay detainees with links to the UK.
Kate Allen, the human rights group's UK director, said: "It's nothing short of a disgrace that Binyam has been held in harsh conditions for all these years, having to resort to a hunger strike to raise awareness of his plight.
"The immediate focus should now be on providing medical and other support for Binyam on his return to the UK.
"But we also need a proper independent inquiry into Binyam's case and allegations of a cover-up over torture, as well as into the wider practice of rendition and secret detention."
The Shadow foreign secretary William Hague called for the publication of a section of a High Court judgment about Mr Mohamed's treatment which has so far been kept secret.
He said: "Now that the United States government has decided to release Binyam Mohamed, there is no reason for the Government not to ask the US to allow the controversial paragraphs related to his case to be published.
"The serious questions about the British Government's role in Binyam Mohamed's detention will not simply go away.
"Publishing these paragraphs would allow speculation to be brought to an end."