Iran has released a U.S. permanent resident and Lebanese citizen charged with spying for the United States, according to his attorney.

Nizar Zakka, a 52-year-old IT expert who lived for years in Washington, D.C., was handed over Tuesday to Lebanese officials in Tehran and is expected to arrive in Beirut within hours.

Zakka was imprisoned in Iran for the past 3 ½ years and faced a 10-year sentence and a $4.2 million fine for allegedly spying -- charges human rights activists and U.S. officials vigorously deny.

His release has been billed as a gesture of goodwill between Iran and Lebanon. It’s unclear what role, if any, U.S. officials played in the negotiations and what Zakka’s release portends for several other Americans who remain behind bars in Iran.

“After more than 1,350 days in captivity in Iran, we have received excellent news: Mr. Nizar Zakka is a free man,” attorney Jason Poblete said in a statement. “Nizar looks forward to reuniting with family and friends. Nizar expresses his sincerest thanks to those who never forgot him.”

“Nizar also wants to remind those who can help that there remain many Americans, [U.S. permanent legal residents], and other foreigners in Iranian prisons,” Poblete added. “Nizar grew close to some of these men; they need help and want to come home.”

During a news conference Tuesday, Iran Judiciary spokesman Gholamhossein Esmaeeli said Zakka’s release was not politically motivated and came about because Iranian law allows for a “conditional release” of prisoners who serve one-third of their confinement, demonstrate good behavior during that period and pledge not to commit crimes after their release.

“This is a totally judicial process without any political stances or [prisoner] exchange being considered,” Esmaeeli said.

Iran granted Zakka’s freedom amid escalated tensions between it and the United States. Although both Washington and Tehran have tried to tamp down talk of a military clash, Iranian Foreign Minister Mohammad Javad Zarif on Monday warned the U.S. that it “cannot expect to stay safe” after what he described as an economic war being waged against his nation.

State Department spokeswoman Morgan Ortagus dismissed Zarif’s threats as “typical behavior” from the Iranian government as it struggles to deal with the Trump administration’s campaign of economic and diplomatic pressure.

“We aren’t impressed,” she said during a press briefing Monday. “Iran faces a simple choice: It can either behave like a normal nation or watch its economy crumble.”

Ortagus separately responded to reporters’ questions about Zakka’s impending release, saying only: “We certainly hope these reports that he has been released are accurate.”

Fars, the Iranian news agency, reported Monday that Zakka was being released out of respect for Hassan Nasrallah, the leader of Hezbollah, which the United States regards as a terrorist organization.

Zakka’s family on Thursday issued a statement heralding a breakthrough in negotiations between Iranian and Lebanese officials to release him and offered their “deepest gratitude” to Lebanese President Michael Aoun and Gen. Abbas Ibrahim on their “outstanding efforts to bring Nizar home safely.”

Zakka was arrested on espionage charges in September 2015 after participating in a government-sponsored Tehran conference on women and sustainable development. His family and human rights activists vigorously deny the spying charges and point out that he had been invited to participate in the conference by Shahindokht Molaverdi, Iran’s then-vice president for women and family affairs.

After initial media reports that he would be freed began surfacing last week, a State Department spokesperson welcomed the news but called the negotiations a “matter between Lebanon and Iran.”

However, that statement runs counter to a direct quote from Zarif during a visit to Lebanon in 2016. “What happened with Mr. Zakka is not a problem between Iran and Lebanon, seeing as the problem was the violation of the applicable laws in Iran by a foreigner, and the problem is actually between the United States and Iran,” the Iranian foreign minister said at the time.

Indeed, Secretary of State Mike Pompeo has been well versed on Zakka’s plight since at least the fall of 2016 when he mentioned his “unlawful detention” by Iran during a speech on the House floor while Pompeo was still a member of Congress.

“His only crime was to bring greater internet access to the women of Iran,” Pompeo said of Zakka at the time.

Since then, Congress has passed at least six different measures calling on Iran to release Zakka and several other imprisoned Americans, including Siamak Namazi and his father, Baquer, both dual U.S.-Iranian nationals; Princeton University graduate student Xiyue Wang; and former FBI agent Robert Levinson, who was last seen on Iran’s Kish Island in 2007 and is the longest held hostage in American history.

Jared Genser, a human rights lawyer who represents the Namazis, said Zakka is a U.S. green-card holder and a Lebanese citizen so the negotiations were between Lebanon and Iran.

“It’s obviously great news for Zakka and his family and came about as a result of the Lebanese government consulting with Iran,” Genser told RCP. “… It’s neither going to help nor hurt efforts to secure the release of the Namazis, my clients.”

In 2017, President Trump included in a speech to the United Nations a demand that Iran release all U.S. prisoners and others unjustly detained there.

The following May, Trump withdrew the U.S. form the Obama-era Iran nuclear deal aimed at rolling back Tehran’s nuclear program. Pompeo then announced a new “maximum pressure” campaign against Iran, articulating 12 demands, including that Iran end its nuclear weapons and advanced ballistic missile programs, release hostages, stop supporting terrorism and cease its destabilizing activities in the Middle East.

In April two influential Democratic senators, Tim Kaine and Chris Coons, both senior members of the Foreign Relations Committee, sent a letter to Trump imploring him to use sanctions relief for countries that want to do business with Iran as leverage to secure the release of Americans unjustly imprisoned there.

Zakka has undergone several hunger strikes during his imprisonment to protest his open-ended detainment. At one point, his family released an audio recording to this reporter in which Zakka claimed his innocence on the spying charges and explained that he had visited Iran on a visa provided by the Iranian government.

"I came to [Iran] based on the official invitation of its vice president for women and family affairs, who also happened to send me a visa to speak at her conference," he said in a July 2017 audio recording taped from inside Iran's notorious Evin prison. "This is against all international laws, therefore I went on an ongoing hunger strike as of yesterday—and ongoing until my death or freedom."

Last September, Molaverdi, the Iranian official who invited him to the conference, told the Associated Press that the government had “failed” to help Zakka and acknowledged the limits Iran’s civilian government faces when challenging the decisions of its judiciary.

In early April, Omar Zakka, Zakka’s son, met with Pompeo and other senior Trump administration officials in Washington and appealed to Lebanese authorities to help negotiate his father’s release.

The meeting came the same week Pompeo met privately with family members of several Americans detained abroad and urged them not to abandon hope. He reiterated his previous statements that freeing their loved ones remains a priority for President Trump but said paying ransoms was not an option to facilitate their freedom.

The Trump administration has continued to reiterate a policy of not paying ransom after Republicans widely criticized the Obama administration for $1.7 billion in cash payments the U.S. made to Iran in early 2016, $400 million of which was timed to ensure the release of four American hostages.

Zakka and the Namazis were left behind in that exchange, and GOP lawmakers have argued that Iran was motivated to continue detaining them in order to extract more cash out of the U.S.

In a related development, Iran has revoked the press accreditation for the New York Times correspondent based in Tehran without explanation, barring him from working for the past four months, the newspaper reported Tuesday. A Times editor, however, said there are some signs the issue could soon be resolved.