Arch-foes the United States and Iran each released five detainees on Monday in a prisoner swap deal that also gives Tehran access to $6 billion in long-frozen oil funds.
The five Americans freed by Iran, including a businessman arrested in 2015, landed in Doha just before 5:40 pm (1440 GMT) on a Qatari jet, hours after the unblocked funds were credited to Iranian accounts in Qatari banks.
The five were greeted on the tarmac before walking in the setting sun to a terminal building, three of them with their arms round each other's shoulders.
Translation: The Qatari plane carrying the five Americans released from Iran arrives at Doha airport.
One of them praised US President Joe Biden for ignoring the political backlash and taking the "incredibly difficult decisions" that freed them.
"Thank you President Biden for ultimately putting the lives of American citizens above politics," Siamak Namazi said in a statement.
Two of the Iranian detainees arrived in Qatar, Iranian media said. The other three released by the United States have opted to remain there or in a third country, Tehran said.
The trigger for the exchange was the release of the $6 billion in funds, frozen by US ally South Korea under sanctions against Iran, to the Iranian accounts.
Washington has denied the $6 billion is a ransom payment, insisting the money will be used for humanitarian purposes.
"We hope to have total access to the Iranian assets today," Iran's foreign ministry spokesman Nasser Kanani told a news conference in Tehran earlier on Monday.
"The prisoner exchange will take place on the same day and five Iranian citizens imprisoned in America will be released."
As the prisoners were released, Biden granted clemency to the five Iranians and announced sanctions against Iran's ex-president Mahmoud Ahmadinejad and the country's intelligence ministry.
The sanctions were imposed over alleged deceit over the disappearance of Bob Levinson, a former FBI agent who disappeared in Iran in mysterious circumstance and is presumed dead.
As the prisoners were released, US President Joe Biden announced sanctions against Iran's ex-president Mahmoud Ahmadinejad and the country's intelligence ministry.
Biden also granted clemency to the five Iranian ex-detainees.
The five Americans - all considered Iranian nationals by Tehran, which rejects dual nationality - were released to house arrest when the deal was agreed last month.
Among the Americans is Siamak Namazi, a businessman arrested in 2015 on spying charges which his family has rejected.
The others are wildlife conservationist Morad Tahbaz, venture capitalist Emad Sharqi, and two others who wished to remain anonymous.
Last week, the official IRNA news agency identified the five Iranian prisoners.
They include Reza Sarhangpour and Kambiz Attar Kashani, both accused of having violated US sanctions against Tehran.
A third prisoner, Kaveh Lotfolah Afrasiabi, was detained at his home near Boston in 2021 and charged with being an Iranian government agent, according to US officials.
The two others, Mehrdad Moein Ansari and Amin Hasanzadeh, were said to have links to Iranian security forces.
The White House has denied that the unfreezing of the Iranian funds was effectively a ransom payment.
Biden's administration has insisted that Iran will only be allowed to use the money to buy food, medicine and other humanitarian goods.
Iran, which has been deeply hostile to the US since the 1979 Islamic revolution overthrew the pro-Western monarch, has denied restrictions have been placed on the spending of funds.
Iran's Kanani has insisted that the money will allow Tehran to "purchase all non-sanctioned goods", not just food and medicine.
Biden took office with hopes of restoring the landmark 2015 nuclear agreement, under which Iran promised to constrain its contested nuclear work in return for sanctions relief.
But months of talks failed to produce a breakthrough.
Prospects for resolving the dispute sank further after protests broke out in Iran last year following the death in custody of Mahsa Amini, who had been arrested for allegedly violating the country's Islamic dress code.
The release of the prisoners comes just days after the first anniversary of her death, and as Biden and Iran's president, Ebrahim Raisi, are in New York for the annual UN General Assembly, although they are not expected to meet.