Iran announced on Saturday it has freed four US citizens from its custody, including Washington Post reporter Jason Rezaian, ahead of the expected implementation of its landmark nuclear deal with world powers.
A fifth US citizens, student Matthew Trevithick, was also released by Iran later in the day whose freedom was negotiated in a separate agreement.
It was not immediately clear when Trevithick was released.
"In line with orders from the Supreme National Security Council and in the national interest, four Iranian dual national prisoners have been released in a prisoner swap," Tehran public prosecutor Abbas Jafari Dowlatabadi was quoted as saying by Iranian news agencies.
IRNA news agency's English language service quoted him as saying the freed prisoners were Iranian-Americans.
US State Department officials long said the release of its citizens from Iran– who faced dubious charges and delayed, secret trials– was a separate matter from the nuclear issue. But US efforts to win their release were in tandem with the nuclear negotiations, which marked unprecedented communication between the two countries.
In addition to Rezaian, who was taken into custody in 2014, the other three Americans known to be in US custody include former US Marine Amir Hekmati, accused of espionage; Saeed Abedini, a pastor, jailed in 2012; and Nosratollah Khosrawi-Roodsari, according to Iranian media.
It said the swap included a clause under which the United States would no longer pursue the extradition of 14 Iranians for alleged involvement in purchasing arms in the United States for supply to Iran.
IRNA news agency named the seven Iranians it said had been freed from jail in the United States as part of a prisoner swap with the Islamic Republic.
The English language service of the official agency named them as Nader Modanlo, Bahram Mechanic, Khosrow Afghahi, Arash Ghahreman, Tooraj Faridi, Nima Golestaneh and Ali Sabouni.
"Through a diplomatic channel that was established with the focus of getting our detained US citizens home, we can confirm Iran has released from imprisonment four Americans detained in Iran," a US official said. "Iran has also committed to continue cooperating with the United States to determine the whereabouts of Robert Levinson."
Levinson, a former FBI agent who disappeared from Kish Island, Iran, on March 9, 2007 while a business trip as a private investigator, has been the focus of US efforts for almost nine years. Friends of Levinson said that, around that time, he had been investigating the counterfeiting of cigarettes, though mainly in Latin America.
Earlier in the day, US prosecutors moved to drop charges against four Iranians accused of violating US sanctions against Iran, federal court filings showed, as Iranian media reported Iran had released four Americans held in Iranian jails.
Citing "significant foreign policy interests" of the United States, federal prosecutors in four states - Massachusetts, New York, California, and Texas - asked federal judges to dismiss charges against Iranians who prosecutors said helped Iran procure US technology and goods in violation of US sanctions. Dozens of Iranians have been charged with US sanctions violations since 2008.
Reuters contributed to this report.