Updated

Four Americans and seven Iranians got tickets to freedom in a prisoner swap playing out alongside the kick-start of an accord lifting heavy international sanctions on Iran in return for its agreement to pull back its nuclear program. A fifth American was released separately.

The negotiated exchange eases one leading irritant as the two countries gingerly explore prospects for a smoother relationship after decades of hostility — even as they remain sharply at odds on other fronts.

Washington Post reporter Jason Rezaian, former U.S. Marine Amir Hekmati, pastor Saeed Abedini and Nosratollah Khosravi-Roodsari, whose name had not been previously made public, were freed from custody in Iran and were to be flown to Switzerland, U.S. officials said. U.S. student Matthew Trevithick was released independently of the exchange on Saturday and already was on his way home.

In turn, the U.S. will pardon or drop charges against seven Iranians — six of whom are dual U.S.-Iranian citizens — accused or convicted of violating U.S. sanctions.

Three were serving prison terms and now have received a commutation or pardon. Three others were awaiting trial; the last one made a plea agreement.

It's unclear if they will leave the U.S. for Iran. They are free to stay in the United States.

In addition, the U.S. will drop Interpol "red notices" — essentially arrest warrants — on 14 Iranian fugitives it has sought, officials said.

The announcement of the exchange came shortly before Iran was certified as having met all commitments under the nuclear deal with six world powers.

U.S. Secretary of State John Kerry, Iranian Foreign Minister Mohammad Javad Zarif and other officials involved in the accord met in Vienna as the diplomatic achievement unfolded.

The release of the prisoners and the nuclear deal developments capped weeks of intense U.S.-Iran diplomacy that took several unexpected turns after an Iranian ballistic missile test in October and then the detention on Jan. 12 by Iran of 10 U.S. Navy sailors and their two boats in the Persian Gulf.

The four Americans released in Iran under the negotiated prisoner exchange were still in that country Sunday as arrangements progressed to get them out, said a senior Obama administration official. Speaking on condition of anonymity because of the sensitivity of the situation, the official said efforts were underway to get the four together and on a plane out of Tehran.

Kerry said the Americans had been released from Iranian custody.

Frederick J. Ryan, Jr., publisher of The Washington Post, said in a statement, "We couldn't be happier to hear the news that Jason Rezaian has been released from Evin Prison. Once we receive more details and can confirm Jason has safely left Iran, we will have more to share."

Hekmati's family released a statement saying: "We thank everyone for your thoughts during this time. There are still many unknowns. At this point, we are hoping and praying for Amir's long-awaited return."

Trevithick's parents said he was freed after 40 days at a prison in Tehran. They did not say why Iran detained him. Trevithick, who is from Hingham, Massachusetts, co-founded a research center based in Turkey that assesses the humanitarian crisis in the area and traveled to Iran in September for a four-month language program.

Republican presidential candidates had slammed the Obama administration for striking the multinational nuclear deal with Iran while Americans were held captive. They welcomed news that the Americans were coming home but offered little to no credit to the president for the negotiations that secured the freedom of the prisoners.

Among Democrats, Hillary Clinton also embraced the developments while saying Iran should not be thanked because it should never have detained the Americans. Her rival for the Democratic nomination, Bernie Sanders, offered unreserved praise for the diplomacy.

Robert Levinson, who disappeared in Iran in 2007 while working for the CIA on an unapproved intelligence mission, wasn't part of the deal. American officials are unsure if the former FBI agent is even still alive. The Iranians have always denied knowing his location.

Levinson's case was aggressively pursued, officials said, adding that Iran has committed to continue cooperating in trying to determine Levinson's whereabouts.

The exchange also didn't cover Siamak Namazi, an Iranian-American businessman who advocated better ties between Iran and the U.S. He was thought to have been arrested in October.

According to the official IRNA news agency, the seven freed Iranians are Nader Modanlo, Bahram Mechanic, Khosrow Afghahi, Arash Ghahraman, Tooraj Faridi, Nima Golestaneh and Ali Saboonchi. It didn't provide any further details.

___

Dareini reported from Tehran, Iran; Lee reported from Washington. Darlene Superville, Donna Cassata and Eric Tucker in Washington, Amy Anthony in Providence, Rhode Island, Adam Schreck in Dubai and George Jahn in Vienna contributed to this report.