* American Xiyue Wang going back to United States
*Iranian Massoud Soleimani freed from US imprisonment
*Switzerland facilitated the exchange
*US-Iranian ties have worsened during Trump's term
The United States and Iran each freed a prisoner on Saturday in a rare swap, an act of cooperation between two longtime foes whose ties have worsened since President Donald Trump took office.
Trump said Xiyue Wang, a US citizen held in Iran for three years on spying charges, was returning to the United States. An Iranian official said that Iranian Massoud Soleimani had been freed from detention in the United States.
Switzerland facilitated the swap and Iranian state news agency IRNA said Foreign Minister Mohammad Javad Zarif welcomed Soleimani in Zurich, where it said the swap took place. It said Soleimani was expected to return to Iran in the coming hours.
In a statement issued by the White House, Trump made no mention of the freeing of Soleimani but 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," he said.
Zarif said earlier the prisoner swap was imminent. Later he 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.
IRNA reported that Wang was released based on "Islamic clemency".
Switzerland represents US diplomatic interests in Iran, since Washington and Tehran cut diplomatic ties shortly after the 1979 Islamic Revolution in Iran.
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. China, which normally requires its citizens to give up their nationality when they become citizens of another country, has not commented publicly on the case.
A senior US official said Brian Hook, the US special representative for Iran, accompanied Soleimani to Switzerland to make the exchange and Hook and Wang were now "en route to Landstuhl in Germany where Wang will be examined by doctors".
It said Wang was expected to stay in Germany for several days. Landstuhl is home to an American military medical centre.
US Secretary of State Mike Pompeo said in a tweet that he was "pleased that the Iranian government has been constructive in this matter". He added "we will not rest until we bring every American detained in Iran and around the world back home".
Hua Qu, Wang's wife, welcomed her husband's release.
"Our family is complete once again. 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," she said in a statement.
"We are thankful to everyone who helped make this happen."
Nizar Zakka, a Lebanese businessman resident in the United States who was freed in June after four years in prison in Iran, told Reuters he was the first to know of the release and had informed Wang's mother and wife.
"Wang's wife has got a visa to travel to Germany. Wang is expected to come to Washington DC on Monday," said Zakka.
Soleimani, a stem cell expert, was arrested at Chicago airport in October 2018 for allegedly attempting to export biological materials to Iran in violation of US sanctions on Iran over its nuclear programme.
Washington has demanded that Iran release 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.
Tensions have heightened between Iran and the United States since Trump last year pulled Washington out of a 2015 nuclear deal between Iran and six major powers and reimposed sanctions that have crippled Tehran's economy. Iran has responded by gradually scaling back its commitments under the agreement.
Jason Rezaian, a Washington Post reporter who was released from Iranian jail in 2016 after being held for 18 months on espionage accusations, said on Twitter: "I'm overjoyed this morning to wake up to the great news that Xiyue Wang is finally free," adding that his imprisonment was "long & unjust".