A US-bound plane carrying five Americans freed by Iran has left Qatar as part of a prisoner swap for five Iranians held in the United States and the transfer of $6 billion (€5.6bn) in Iranian funds, marking a rare deal between the long-time opponents.

"Today, five innocent Americans who were imprisoned in Iran are finally coming home," US President Joe Biden said in a statement shortly before the American detainees descended the stairs of a Qatari jet in Doha to be embraced by US diplomats.

The White House confirmed a plane carrying the five, along with two US family members who left the Iranian capital Tehran with them earlier, was en route to the United States, where they are to be offered medical treatment by the US military as they adjust to freedom.

Separately, Iran's state-owned Press TV said the five Iranians detained by the United States and charged with committing crimes had been freed, an apparent reference to them being granted clemency, and that two had landed in Tehran.

The other three are not expected to return to Iran.

"This was purely a humanitarian action," Iranian President Ebrahim Raisi said after arriving in New York for the United Nations General Assembly.

"It can certainly be a step based upon which in the future other humanitarian actions can be taken."

It is unclear whether the exchange will bring progress on the many issues that divide the two nations, including Iran's nuclear programme, its support for regional Shi'ite militias, the presence of US troops in the Gulf and American sanctions on Iran.

US Secretary of State Antony Blinken confirmed the American citizens had been freed

Relations between the United States and Iran, adversaries for more than 40 years, have been especially bitter since former US president Donald Trump in 2018 reneged on a deal to curb Iran's nuclear programme and reimposed American sanctions.

Washington suspects the programne may aim to develop nuclear weapons - an ambition Tehran denies - that could threaten Israel or US Gulf Arab allies.

US Secretary of State Antony Blinken left the door open to diplomacy on the nuclear issue, which he described as "perhaps the number one issue of concern," but suggested nothing was imminent.

"In this moment, we're not engaged on that, but we'll see in the future if there are opportunities," he told reporters in New York.

US analysts voiced skepticism that progress was likely soon on the nuclear or other issues.

"The prisoner swap does likely pave the way for additional diplomacy around the nuclear program this fall, although the prospect for actually reaching a deal is very remote," said Henry Rome of the Washington Institute for Near East Policy.

"Removing an irritant is different from adding a salve," said Jon Alterman of the Center of Strategic and International Studies.

(L-R) Emad Sharqi, Morad Tahbaz and Siamak Namazi arriving in Qatar after flying out of Iran

In a sign that President Biden - a Democrat - wants to appear tough on Iran and perhaps blunt Republican criticism, he announced fresh US sanctions on Iran's former president Mahmoud Ahmadinejad and its intelligence ministry for "involvement in wrongful detentions."

"We will continue to impose costs on Iran for their provocative actions in the region," he said in the statement, in which he thanked the governments of Qatar, Oman, Switzerland and South Korea for their assistance in securing the releases.

Qatar mediated indirect US-Iran talks on the detainees while Switzerland, which represents US interests in Tehran because the United States and Iran do not diplomatic relations, helped with the transfer of funds from South Korea to Qatar.

A plane sent by Qatar flew the five US citizens and two of their relatives out of Tehran after, it is understood, both sides received confirmation the $6 billion was transferred from South Korea to Qatari accounts.

A prominent Republican, House Foreign Affairs Committee Chairman Michael McCaul, said the transfer of the $6 billion would likely lead to more detentions of US citizens by Iran.

"I am very concerned that this $6 billion hostage deal incentivizes future hostage-taking," Mr McCaul said in an emailed statement.

"There is no question this deal will free up funds for Iran's malign activities."

President Biden aides argue the money belongs to Iran and is being transferred from restricted South Korean accounts to restricted Qatari accounts, where it can only be spent on food, medicine and other humanitarian items with US oversight.

Earlier, two of the five Iranians landed in Qatar, a US official said. Three have opted not to return to Iran.

One of the five freed Americans had been held for about eight years on charges Washington rejected as baseless.

The deal, after months of talks in Qatar, removes a major irritant between the US, which describes Tehran as a sponsor of terrorism, and Iran, which calls Washington the "Great Satan".

The US dual citizens released include Siamak Namazi, 51, and 59-year-old Emad Sharqi, both businessmen, and Morad Tahbaz, 67, an environmentalist who also holds British nationality.

The identities of the fourth and fifth US citizens were not disclosed at their request given their desire for privacy.

Iranian officials have named the five Iranians released by the US as Mehrdad Moin-Ansari, Kambiz Attar-Kashani, Reza Sarhangpour-Kafrani, Amin Hassanzadeh and Kaveh Afrasiabi.