The United States and Iran have each freed a prisoner in a rare act of co-operation between two longtime foes whose ties have worsened since President Donald Trump took office.
Iran released Xiyue Wang, a US citizen who had been held for three years on spying charges, while the US freed Iranian Massoud Soleimani. He had been facing charges of violating US sanctions against Tehran.
A senior US official said Washington was hopeful that Wang's release would lead to the freeing of other Americans held in Iran and that it was a sign Tehran was willing to discuss other issues.
Wang appeared to be in good health and humour, he said.
Switzerland facilitated the swap. Iranian Foreign Minister Mohammad Javad Zarif met Soleimani in Zurich, state news agency IRNA said and it later reported Soleimani's arrival in Iran.
Trump thanked Iran on Twitter for what he called a "very fair negotiation" that led to the exchange. He said the prisoner swap showed that the US and Iran "can make a deal together".
In an earlier statement, Trump thanked the Swiss government for its help in negotiating Wang's release.
"Freeing Americans held captive is of vital importance to my administration, and we will continue to work hard to bring home all our citizens wrongfully held captive overseas," Trump said.
Zarif posted pictures on Twitter of himself with Soleimani talking on board an Iranian plane.
"Glad that Professor Massoud Soleimani and Mr Xiyue Wang will be joining their families shortly. Many thanks to all engaged, particularly the Swiss government," Zarif tweeted.
Arriving in Tehran, Soleimani, a stem cell expert, told reporters the Americans who had held him were "petty".
"I told them that I had patients that needed my help. And they said who cares. Let them die," he said. "It shows that American officials have issues with Iranians."
IRNA reported that Wang was released based on "Islamic clemency".
The releases were the result of three or four weeks of intensive negotiations, the senior US official said.
"We're hopeful this will lead us to further success with Iran," he told reporters in a conference call.
Switzerland represents US diplomatic interests in Iran, since Washington and Tehran cut diplomatic ties shortly after the 1979 Islamic Revolution.
Wang, a Princeton University graduate student, was convicted on espionage charges and sentenced to 10 years in prison in 2017. His family and the university have always said he was in Iran for research into a history degree and denied spying.
According to Princeton, he was born in Beijing in 1980, emigrated to the United States in 2001 and became a naturalised US citizen in 2009. His wife and child are Chinese citizens.
Soleimani was arrested at Chicago airport in October 2018 over US allegations he tried to export biological materials to Iran in violation of sanctions imposed by Washington because of its nuclear program.
Soleimani had been due to appear in court on December 11 but the charges against him had been dropped, the senior official said.
He said no ransom had been paid or any other sort of concession made by the US.
"But what I can tell you in light of the status of Mr Soleimani's case, this was an extraordinarily good outcome for the United States of America," the official said.
Wang would be examined by doctors in Germany, where he was expected to stay for several days, the official said.
US Secretary of State Mike Pompeo said on Twitter he was "pleased that the Iranian government has been constructive in this matter".
Hua Qu, Wang's wife, told Reuters she was "happy".
"Our family is complete once again," she said in a separate statement. "Our son Shaofan and I have waited three long years for this day and it's hard to express in words how excited we are to be reunited with Xiyue.
"We are thankful to everyone who helped make this happen."
Washington has demanded that Iran release all the Americans it is holding, including father and son Siamak and Baquer Namazi; Michael R. White, a Navy veteran imprisoned last year, and Robert Levinson, a former FBI agent missing since 2007.
Several dozen Iranians are being held in US prisons, many of them for breaking sanctions.