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.
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.
Iran generated the $6 billion through oil sales to South Korea, which blocked the funds after the United States under former president Donald Trump reimposed sanctions as he withdrew from a landmark nuclear accord.
Iran's central bank governor said Iran would seek damages from South Korea for withholding the funds. "The equivalent of 5.57 billion euros ($5.95 billion) was deposited in six Iranian accounts with two Qatari banks on Monday," he said.
"We're making a complaint on behalf of Iran against South Korea for not giving access to these funds and the reduction in value of these funds in order to receive damages," Mohammadreza Farzin said on state TV.
The five Americans of Iranian descent -- all considered Iranian nationals by Tehran, which rejects dual nationality -- were released to house arrest when the deal was agreed last month.
They included 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 violating 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.
Biden's administration has insisted Iran will only be allowed to use the unfrozen funds 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 any restrictions on use of the funds.
Iran's Kanani has insisted 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 for women.
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.