DUBAI/WASHINGTON (Reuters) - The United States and Iran each freed a prisoner on Saturday in a rare act of cooperation between two longtime foes whose ties have worsened since President Donald Trump took office.

Iran released Xiyue Wang, a U.S. citizen who had been held for three years on spying charges, while the United States freed Iranian Massoud Soleimani. He had been facing charges of violating U.S. sanctions against Tehran.

A senior U.S. 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 humor, he said.

Switzerland facilitated the swap. Iranian Foreign Minister Mohammad Javad Zarif met Soleimani in Zurich, state news agency IRNA said. Soleimani, who then flew to Iran, was accompanied to Switzerland by Brian Hook, the U.S. special representative for Iran, according to a U.S. official.

Trump thanked Iran on Twitter for what he called a “very fair negotiation” that led to the exchange. He said the swap showed the United States 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.

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 U.S. official said.

“We’re hopeful this will lead us to further success with Iran,” he told reporters in a conference call.

Switzerland represents U.S. diplomatic interests in Iran, since Washington and Tehran cut diplomatic ties shortly after the 1979 Islamic Revolution.

CHARGES DROPPED

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 naturalized U.S. 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.

Slideshow ( 6 images )

Soleimani was arrested at Chicago airport in October 2018 over U.S. allegations he tried to export biological materials to Iran in violation of sanctions imposed by Washington because of its nuclear program.

Tensions have risen 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 removing its commitments under the agreement.

Soleimani had been due to appear in court on Dec. 11 but the charges against him were dropped, the senior official said.

He said no ransom was paid or any other sort of concession made by the United States. He referred questions on the status of Soleimani’s legal case to the Department of Justice.

Slideshow ( 6 images )

“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.

Asked about the status of Soleimani’s case, a senior Department of Justice official sent Reuters an Atlanta court order showing the criminal indictment was dismissed on Saturday.

“The President made a decision in this matter based on foreign policy considerations. The Administration has effectuated this decision,” the official said in an email.

‘THREE LONG YEARS’

The second U.S. official said Wang would be examined by doctors in Germany, where he was expected to stay for several days.

U.S. Secretary of State Mike Pompeo wrote 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.”

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 told Wang’s mother and wife.

“Wang’s wife has got a visa to travel to Germany. Wang is expected to come to Washington, D.C., on Monday,” said Zakka.

Washington has demanded that Iran release all the Americans it is holding, including father and son Baquer and Siamak Namazi; Michael R. White, a Navy veteran imprisoned last year, and Robert Levinson, a former FBI agent missing since 2007.

“I hope, pray, and expect that this is not a one-time trade but the beginning of an expedited process that will bring my family home soon,” Babak Namazi, Siamak’s brother, said in a statement.

Several dozen Iranians are being held in U.S. prisons, many of them for breaking sanctions.