VIENNA — Iran will release four detained Americans in exchange for seven Iranians held or charged in the United States, U.S. and Iranian officials said Saturday in a major diplomatic breakthrough announced as implementation of a landmark nuclear deal appeared imminent. A fifth American detained in Iran, a student, was released in a move unrelated to the swap, U.S. officials said.

Washington Post reporter Jason Rezaian, former U.S. Marine Amir Hekmati, pastor Saeed Abedini and Nosratollah Khosravi, whose name had not been previously made public, were to be flown from Iran to Switzerland aboard a Swiss aircraft and then transported to a U.S. military hospital in Landstuhl, Germany, for medical treatment, U.S. officials said.

Rezaian's wife and mother were expected to be on the plane.

The student, identified as Matthew Trevithnick, was released independently of the exchange on Saturday and already was on his way home, said U.S. officials. They spoke about the prisoner exchange on condition of anonymity because they were not authorized to discuss it publicly.

In return, 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 these individuals will leave the U.S. for Iran. They are free to stay in the United States.

× Fear of missing out? Sign up for the Early Bird Brief - a daily roundup of military and defense news stories from around the globe. Thanks for signing up. By giving us your email, you are opting in to the Early Bird Brief.

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

The announcement of the exchange came as the International Atomic Energy Agency was close to certifying that Iran had met all commitments under the nuclear deal with six world powers.

U.S. Secretary of State John Kerry was meeting in Vienna with Iranian Foreign Minister Mohammad Javad Zarif and other officials involved in the accord, and it was expected that such certification could come Saturday.

The release of the prisoners and the nuclear deal developments cap a week of intense U.S.-Iran diplomacy that took an unexpected turn on Tuesday with the detention by Iran of 10 U.S. Navy sailors and their two boats in the Persian Gulf. The sailors were released in less than 24 hours after Kerry intervened with Zarif in multiple telephone calls that administration officials hailed as a channel of communication opened because of the nuclear negotiations.

"Through a diplomatic channel that was established with the focus of getting our detained U.S. citizens home, we can confirm Iran has released from imprisonment four Americans detained in Iran," one of the U.S. officials said.

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 lawyer, Mahmoud Alizadeh Tabatabaei, said Hekmati called him earlier Saturday from prison.

"He told me that judiciary officials have called for a meeting with him. But I've not been formally informed if he is free now," he said, adding that negotiations for the prisoners' release has been going on for the past two months.

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

The negotiations over the American detainees grew out of the Iran nuclear talks. In discussions in Europe and elsewhere, Kerry and nuclear negotiator Wendy Sherman were able to establish a separate channel of talks that would focus on the U.S. citizens.

But that channel was kept separate from the nuclear conversations. American officials didn't want the citizens used as leverage in the nuclear talks, and didn't want to lose their possible release if the talks failed to produce an agreement.

The discussions then gained speed after last July's nuclear deal. In talks in Geneva and elsewhere, a team led by Obama's anti-Islamic State group envoy, Brett McGurk, worked on the details of a possible prisoner swap. The Iranians originally sought 19 individuals as part of the exchange; U.S. officials whittled down the number to seven.

U.S. officials stressed that the Americans were a priority. But the Iranians wanted a goodwill gesture or reciprocal measure in return, the officials said.

Rezaian was born in California and holds both U.S. and Iranian citizenship. He was convicted in closed proceedings last year after being charged with espionage and related allegations. The Post, for which he covered Iran, and the U.S. government have denied the accusations, as has Rezaian.

Hekmati, of Flint, Michigan, was detained in August 2011 on espionage charges. Hekmati went to Iran to visit family and spend time with his ailing grandmother.

Abedini of Boise, Idaho, was detained for compromising national security, presumably because of Christian proselytizing, in September 2012. He was sentenced in 2013 to 8 years in prison.

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, the 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 reportedly arrested in October.

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

The Obama administration has said the Americans came up in every conversation with the Iranians.

___

Dareini reported from Tehran, Iran. Associated Press writers Matthew Lee and Donna Cassata in Washington, Adam Schreck in Dubai and George Jahn in Vienna contributed to this report.