British-Iranian mum Nazanin Zaghari-Ratcliffe is returning to the UK today after being detained for six years in Tehran.
Fellow Brit Anousheh Ashouri, who was detained in 2017, has also been freed and the pair are expected to arrive at home later tonight.
Morad Tahbaz, an American-Iranian national, who also holds British citizenship, remains in Iran but he has been released on furlough from prison.
Foreign Secretary Liz Truss said: "I can confirm Nazanin Zaghari-Ratcliffe and Anoosheh Ashoori will return to the UK today, and Morad Tahbaz has been released from prison on furlough.
"They will be reunited with their families later today. We will continue to work to secure Morad's departure from Iran."
Mrs Zaghari-Ratcliffe was held by the Iranian Revolutionary Guard on trumped up national security charges in 2016 after a holiday to introduce her young daughter Gabriella to her parents.
Her husband Richard, who lives with six-year-old Gabriella in Hampstead, London, has campaigned tirelessly for her release, including by going on hunger strike in October last year.
Mr Ashouri, a retired engineer, was arrested in 2017 on spying charges after travelling out to visit his mother.
Conservationist Morad Tabaz was detained by the authorities in 2018.
The news comes after efforts by five British Foreign Secretaries tried to secure their release, including Boris Johnson who was widely criticised for telling a Commons committee in 2017 that she was teaching journalism in the country. Her family have always denied the claim.
Ms Truss and Foreign Office officials have been engaged in intensive behind-the-scenes talks to secure their release and officials finally found a way to settle a 40-year-debt.
Here's how the deal was done.
Negotiations have been underway for a long time over securing the release of Nazanin Zaghari-Ratcliffe and other British nationals in Iran.
Talks are understood to have intensified over the past six months, with help from the authorities in Oman.
The pair are due to touch down in the Gulf state before returning to the UK later today.
Alongside these talks, the UK has also settled a £394 million debt to Iran which has proved a stumbling block to the release of British dual nationals.
The 40-year row centres on Britain's sale of tanks to the Shah of Iran in the 1970s.
But the UK refused to send the tanks after the Iranian revolution, when the Shah was overthrown.
Britain has today paid the debt, which appears to have been a significant moment in the release of the detainees.
Officials have been working around the clock to find ways to pay the debt while complying the international sanctions imposed on Iran.
The Foreign Office finally agreed that the funds can solely be used for humanitarian purposes.
Ms Truss said it had been done "in full compliance with UK and international sanctions and all legal obligations".
The top Tory is said to have made securing their release and resolving the debt her top priorities when she took over as Foreign Secretary in September.
After meeting all the families, she held talks with her Iranian counterpart in New York and tasked officials to hold talks in Tehran over October and November.
Omani ministers acted as mediators to help free the prisoners, with Ms Truss meeting the Omani Foreign Minister at Chevening in December.
Negotiators travelled out to Oman's capital Muscat, last month to finalise the terms of their release.
Ms Truss spoke twice to Iranian Foreign Minister Amir-Abdollahian in a final push to bring negotiations to a successful conclusion
Talks have been ongoing for some time over the fate of the Brits in Iran but it is understood that the repayment of the debt got the deal over the line.
However Mr Tabaz is still being kept in Iran on furlough from prison and there are other dual nationals who have not been freed.