A Chinese-born US citizen sentenced to 10 years in prison in Iran on spying charges has been released as part of a prisoner swap.

Princeton graduate student Xiyue Wang, imprisoned since 2016, was exchanged for Masoud Soleimani, an Iranian scientist arrested at Chicago airport last year and convicted on charges of violating US trade sanctions.

Wang was due to fly to the US via Oman and a US military base in Frankfurt, Germany. There had been no prior indication he was due to be released, and he was apparently shocked when he was told the news. He initially travelled to Iran to study Farsi and Iranian history.

In a statement, Donald Trump said: “Mr Wang had been held under the pretence of espionage since August 2016. We thank our Swiss partners for their assistance in negotiating Mr Wang’s release with Iran.”

The Swiss embassy in Tehran looks out for America’s interests in the country as the US embassy there has been closed since the 1979 student takeover and 444-day hostage crisis.

In a less diplomatic tweet, Trump said Wang had been “taken during the Obama Administration (despite $150 Billion gift), returned during the Trump Administration.”

Trump has repeatedly claimed his predecessor “gave” Iran $150bn. According to the Washington Post’s Fact Checker column, the figure is actually an “upper range estimate” for Iranian assets unfrozen under the nuclear deal with Tehran in 2015.

On Saturday, the president also thanked Tehran for “a very fair negotiation” and said: “See, we can make a deal together!”

Senior Administration official says Xiyue Wang is “doing really well” in Germany after State Iran envoy Brian Hook swapped for him in Zurich. Hook and Wang pictured. pic.twitter.com/qS1oz7sE3n — Rich Edson (@RichEdsonDC) December 7, 2019

Brian Hook, the US special representative for Iran, accompanied Soleimani to Switzerland to make the exchange and will return with Wang, according to a US official who spoke to the Associated Press on condition of anonymity.

The swap took place in Zurich and Hook and Wang were en route to Landstuhl in Germany where Wang was to be examined by doctors, the official said. Hook was expected to return to the US from Germany alone, as Wang was expected to be evaluated for several days.

Although Hook was present for the swap, the US official said the national security adviser Robert O’Brien played the lead role in negotiations dating from his time as special representative for hostage affairs at the state department.

Soleimani – who works in stem cell research, hematology and regenerative medicine – was arrested by US authorities on charges he violated trade sanctions by trying to have biological material brought to Iran. He and his lawyers maintain his innocence, saying he seized on a former student’s plans to travel from the US to Iran in September 2016 as a chance to get recombinant proteins used in his research for a fraction of the price he would pay at home.

On Saturday Iran’s state-run IRNA news agency reported that Soleimani was with Iranian officials in Switzerland. Soleimani was expected to return to Iran in the coming hours. Zarif later posted pictures of himself on Twitter with Soleimani in front of an Iranian government jet and later with the two talking on board.

The US regards the swap as a low price for the release of Wang, who has always insisted he is innocent and whose family has described the charges as absurd. He was researching the Qajar dynasty at the time of his arrest in August 2016. Hua Qu, his wife, released a statement saying “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. “We are thankful to everyone who helped make this happen.”

The Princeton spokesman Ben Chang said the school was aware of Wang’s release.

Relations between the US and Iran reached a new low this week with further sanctions slapped on Tehran. A meeting with the remaining signatories of the joint comprehensive plan of action (JCPOA) on Friday in Vienna ended with Europeans warning that further breaches of the nuclear deal by Iran would endanger their support.

Ironically Britain, with better relations with Iran at least over the JCPOA, is making no progress, at least on the surface, in securing the release of its dual nationals held in Evin prison including Nazanin Zaghari-Ratcliffe and a retired businessman, Anousheh Ashoori.

Both consider themselves hostages captured in a bid to force diplomatic or economic concessions.

The Iranian foreign affairs minister, Mohammad Javad Zarif, and Masoud Soleiman inside an airplane at an undisclosed airport in Switzerland. Photograph: Iranian Foreign Ministry Handout/EPA

Other Americans held in Iran include an 81-year-old businessman, Baquer Namazi, who has been held for more than two years and diagnosed with epilepsy.

Namazi and his son Siamak Namazi, also a dual national who has been held for more than three years, are serving 10-year sentences after they were convicted of collaborating with a hostile power.

An Iranian-American art dealer, Karan Vafadari, and his Iranian wife, Afarin Neyssari, received 27-year and 16-year prison sentences, respectively. Also held is US navy veteran Michael White.

The former FBI agent Robert Levinson, who vanished in Iran in 2007 while on an unauthorized CIA mission, remains missing. Iran says Levinson is not in the country and that it has no further information, but his family holds Tehran responsible for his disappearance.

The US secretary of state, Mike Pompeo, said Wang would soon be able to go home to his family but acknowledged other Americans remain held by Iran.

“The United States will not rest until we bring every American detained in Iran and around the world back home to their loved ones,” Pompeo said in a statement.