US Secretary of State John Kerry addresses a news conference at United Nations Human Rights Council on Monday.  Picture:  AFP PHOTO/EVAN VUCCI
US Secretary of State John Kerry. Picture: AFP PHOTO/EVAN VUCCI

WASHINGTON — For a year, Obama administration officials had been meeting in secret with Iranian counterparts, seeking to free Americans imprisoned in the Islamic Republic. Finally last fall, a deal for a prisoner release seemed all but sealed.

But the Iranians arrived at the latest clandestine session in a Geneva hotel suite with a whole new proposal that insisted on the release of dozens of Iranians held in US prisons, essentially returning to initial demands that had long since been rejected.

The Americans were flabbergasted. "We’ve already talked about this," said Brett McGurk, lead negotiator. But the Iranians were adamant, according to US officials informed about the meeting. Something back home had changed, part of the continuing battle inside Iran over how to deal with the US. Someone in power in Tehran, it seemed, did not want a deal after all.

And so Mr McGurk and his team picked up their papers and walked out, putting an abrupt end to the meeting. Mr McGurk’s interlocutors had come from Iran’s state security apparatus, a group that had barely, if ever, met Americans, much less negotiated with them. They did not have the well-traveled, English-speaking demeanour of the two senior Iranians who had been negotiating the larger nuclear deal with the US for more than two years.

Eventually, the deal got put back together by US Secretary of State John Kerry and the US-educated Iranian foreign minister, Mohammad Javad Zarif. Five Americans left Iran over the weekend in exchange for seven Iranians freed by the US.

But it took 14 months of turbulent talks punctuated by high diplomatic drama and multiple near-collapses that paralleled the final year of nuclear negotiations. The secret negotiations were weighted by the baggage of a bitter history as the Iranian representatives berated their counterparts over past grievances, including the CIA-backed coup in 1953, collusion with the shah in the late ’70s, and US support for Iraq in its war with Iran in the 1980s.

The Iranians were not the only ones grappling with divisions within their government about a possible deal. In Washington, the Obama administration was engaged in a vigorous debate about whether to trade Iranian prisoners and, if so, which ones, with Attorney General Loretta E Lynch objecting to any deal that equated innocent Americans seized for political gain with Iranian criminals indicted or convicted under Western legal traditions.

In the end, officials said US President Barack Obama decided that to spare the Americans years — if not life — in an Iranian prison, he would make what he called a "one-time gesture" by releasing Iranians who had been accused or convicted of violating sanctions that he was lifting anyway as part of the nuclear agreement.

Even then, there was a last-minute dispute on the airport tarmac — what one US official said "was like a scene out of ‘Argo’" — as Iran refused to allow the mother and wife of one of the prisoners, Jason Rezaian of The Washington Post, to leave with him.

Only after Mr Kerry made an urgent phone call to the Iranian foreign minister did the aircraft receive permission to take off with all the passengers.

Republican critics, while celebrating the release of the Americans, questioned the cost.

"I think it’s a very dangerous precedent," senator Ted Cruz of Texas, a leading Republican presidential candidate, said on Fox News Sunday. "The result of this, every bad actor on earth has been told to go capture an American. If you want terrorists out of jail, capture an American and President Obama is in the let’s-make-a-deal business."

Mr Obama authorised a secret diplomatic channel to Iran to negotiate for their release even as he was seeking a deal on Tehran’s nuclear programme. Mr McGurk, a top State Department official who had just brokered the departure of Iraq’s problematic prime minister, was tapped in October 2014 to lead the new talks with Iran.

Brought togetherby the Swiss, who represent US interests in Tehran, Mr McGurk’s team sat down with their Iranian counterparts in Geneva for the first time in November 2014, according to an account provided by several American officials on the condition of anonymity.

On their list were Rezaian, who was arrested in July 2014; Amir Hekmati, a Marine veteran from Michigan seized in August 2011 while visiting relatives; and Saeed Abedini, a pastor from Idaho imprisoned since 2012. The Americans also bargained for the release of Nosratollah Khosravi, a businessman whose case had not been public until over the weekend.

While the two sides met every month or six weeks, they spent more time arguing than agreeing until the nuclear accord was finalised in July. After that, momentum built to reach an accommodation. US entreaties for better treatment for the prisoners got some results.

To avoid the appearance of caving in to the Americans, the Iranians proposed trading the prisoners for about 40 people held not just in US custody but elsewhere, too. The Americans quickly rejected that, but they took home the idea of a swap.

In the White House and especially at the Justice Department, some officials were leery of going down that road. This was not the same as the Cold War when spies were traded for spies. Mr Rezaian and the others were being held unjustly, Ms Lynch and other officials argued, and should be released accordingly.

No one proposed releasing convicted terrorists or others accused of violent crimes, but Mr Obama came to the conclusion that he would be willing to swap some Iranians who were targeted for economic crimes. The Iranians came up with a list of 19 names, and each case was closely examined by Ms Lynch’s department and other agencies.

Objections to some names whittled the list down to one Iranian and six Iranian-Americans charged or convicted of violating sanctions.

By the time Mr Kerry met with Mr Zarif on October 29 on the sidelines of talks about Syria, the two sides seemed close. The blowup came a few weeks later when Mr McGurk’s team met again with its opposite, leaving some Americans worried that the whole effort would fall apart. Mr Kerry pulled Mr Zarif aside during another Syria-related session in December and the two managed to get back to an accord.

The breakthrough came at the same time the Iranians were making speedy progress toward complying with the terms of the nuclear deal by disabling a plutonium reactor, turning off centrifuges and shipping enriched uranium out of the country.

US officials said the timing was not deliberate, but rather a function of improved relations between two sides that each felt eager to sweep long-standing issues out of the way at last. But last-minute obstacles kept threatening the agreement.

In December, Iran arrested Matthew Trevithick, a 30-year-old American studying Farsi in Tehran. With a deal nearly at hand, US negotiators told the Iranians that they expected him to be released but would not include him in their talks because they feared Tehran would then demand the release of more Iranians.

Then on Tuesday, just as the nuclear and prisoner deals were heading to finality, two US Navy patrol boats drifted into Iranian waters and 10 US sailors were detained in what a US official called "a perfect storm".

US officials warned that, as a political matter, the president would not be able to lift sanctions on Iran if the sailors were still in custody.

Mr Kerry called Mr Zarif repeatedly and the sailors were released the next morning, which the Americans took as a sign that Iran really wanted to conclude both deals. The State Department began calling families to let them know talks were going well.

The two sides decided to announce the prisoner swap along with the carrying out of the nuclear deal. Mr Trevithick, although not technically part of the deal, was released on Saturday and immediately left the country on a commercial flight. Mr Khosravi opted to stay in Tehran after Swiss consular officers made sure that was his choice. The other three were taken to the airport to leave on a Swiss aircraft.

But even then, more 11th-hour disagreements bubbled up. One was over the wording of documents related to the nuclear agreement that held up the announcements. At 9pm on Saturday in Vienna, Mr Kerry met in his hotel with Mr Zarif and the European Union (EU) representative and had the French foreign minister on the secretary’s cellphone.

Mr Kerry held the phone up so that various participants could offer their adjustments to the wording. Finally about 9.30pm, everyone agreed it was done.

After Mr Zarif and the EU representative made their announcement, Mr Kerry got word from Geneva that there was a hitch releasing the remaining three US prisoners. Iran would not allow Mr Rezaian’s wife, Yeganeh Salehi, and mother, Mary, aboard.

Mr Kerry called Mr Zarif as the Iranian headed to the airport. "Javad, look, it’s part of the agreement," Mr Kerry told him, as he later recounted to reporters on his flight. Mr Zarif, he said, assigned four people to fix the problem.

By then, the families were edgy with anticipation, many rushing to fly to Germany to meet their liberated relatives. Mr Obama began calling them to let them know. He reached Sarah Hekmati, a sister of Mr Hekmati, while she and her husband, Dr Ramy Kurdi, were driving to Detroit Metropolitan Airport.

Later she got a call from her brother.

Her first words to him were: "Am I talking to a free man here?"

She was.

NYTimes.com