U.S. Navy veteran Michael White, who has been detained in Iran for nearly two years, is returning home as part of a prisoner swap between Washington and Tehran.
White's release on June 4 is part of a back-channel deal involving the release of an American-Iranian doctor prosecuted in the United States, U.S. and Iranian officials said.
U.S. President Donald Trump said on Twitter he had spoken by phone with White, who took a Swiss plane to Zurich on his way to the United States.
"Thank you to Iran, it shows a deal is possible!" Trump wrote, in an apparent olive branch to Iran.
White was sentenced to 13 years in prison last year for allegedly insulting Iranian Supreme Leader Ayatollah Ali Khamenei and posting private information online.
In March, he was temporarily released on medical grounds amid the coronavirus pandemic to the Swiss Embassy, which represents U.S. interests in Iran.
The navy veteran was detained in July 2018 while he was visiting a woman he had met online and fallen in love with.
White's mother, Joanne White, said in a statement that "the nightmare is over, and my son is safely in American custody and on his way home."
The AP news agency quoted U.S. officials as saying his release was part of an agreement involving Majid Taheri, an Iranian-American physician prosecuted by the Justice Department.
Taheri served 16 months for violating U.S. sanctions against Iran and on June 4 a federal judge released him to go see family in Iran.
The developments follow the deportation to Iran this week of Sirios Asgari, an Iranian scientist detained in the United States.
U.S. and Iranian officials have denied that Asgari's release was part of a prisoner swap.
Switzerland, the intermediary between the U.S. and Iranian governments, has facilitated months of quiet negotiations over prisoners, reports said. Qatar, which has good relations with both the United States and Iran, reportedly also facilitated the prisoner swap.
Iranian Foreign Minister Mohammad Javad Zarif said on Twitter he was pleased the two Iranians and White will join their families.
"This can happen for all prisoners. No need for cherry picking. Iranian hostages held in -- and on behalf of -- the U.S. should come home," he said.
U.S. Secretary of State Mike Pompeo said Iranian authorities had been "constructive" on freeing White but urged the release of three other U.S. citizens, all of Iranian descent, who are detained in Iran.
Observers have speculated that prisoner swaps can offer a rare opportunity for back-channel diplomacy between the two adversaries to start official dialogue, but few see any serious progress before the U.S. election in November.
Relations between Washington and Tehran have become increasingly hostile since 2018, when Trump withdrew the United States from a landmark nuclear deal between Iran and world powers.