An Iranian held in the US and an American held in Iran have been freed, the two sides said on Saturday, in an apparent prisoner swap at a time of heightened tensions.
Tehran announced the release of Iranian scientist Massoud Soleimani from the United States shortly before Washington declared American researcher Xiyue Wang was returning home.
"Glad that Professor Massoud Soleimani and Mr. Xiyue Wang will be joining their families shortly," Iran's Foreign Minister Mohammad Javad Zarif tweeted.
"Many thanks to all engaged, particularly the Swiss government," which has looked after US interests in Iran in the absence of diplomatic ties, Mr Zarif added.
State news agency IRNA said Mr Soleimani had been "freed moments ago after one year of illegal detention and was handed over to Iranian officials in Switzerland".
In a statement issued in Washington, US President Donald Trump said that "after more than three years of being held prisoner in Iran, Xiyue Wang is returning to the United States".
Mr Wang, a Chinese-born American, was serving 10 years on espionage charges in Iran.
A doctoral candidate in history at Princeton University, he had been researching Iran's Qajar dynasty when he was imprisoned in August 2016.
Mr Soleimani is a professor and senior stem cell researcher at Tehran's Tarbiat Modares University who left for the United States on October 22, 2018, according to IRNA.
The United States and Iran have not had diplomatic ties since 1980.
Relations between the two foes worsened in May 2018 when Trump withdrew the US from an international accord that gave Iran relief from sanctions in return for curbs on its nuclear programme.