ISTANBUL — Iran on Tuesday freed Nizar Zakka, a U.S. permanent resident and Lebanese national, from prison after nearly four years behind bars, handing him over to Lebanese officials who had spent months negotiating his release.

Zakka, who was arrested in Tehran in 2015 and convicted of spying for the U.S. government, arrived in Beirut on Tuesday and spoke briefly with reporters.

“I will not detail the conditions of my abduction, the fake accusations and mock trials,” he said.

An Iranian court had sentenced Zakka, an information technology expert and Internet freedom advocate, to 10 years in prison on espionage charges — accusations he denies.

“I will always defend the freedom of expression,” he said. He thanked Lebanese officials for their efforts to secure his freedom and said his case could de-escalate tensions in the region.

The move to free Zakka, 52, was the result of intense negotiations and high-stakes diplomacy between Lebanese and Iranian officials, who said he was released out of respect for the leader of Lebanon’s Hezbollah, a powerful paramilitary group backed by Iran.

Hezbollah, which is part of Lebanon’s coalition government, helped facilitate the diplomacy behind Zakka’s release, Iran’s judiciary spokesman said Tuesday. 

“There were no negotiations with any other individual or government,” Iran’s semiofficial Fars News Agency quoted an Iranian official as saying Monday, in an apparent nod to Zakka’s status as a U.S. resident.

The Trump administration has not said whether it was involved in the efforts to free Zakka, who was detained in Tehran after attending a conference at the invitation of the Iranian government. Some have interpreted Iran’s gesture as an indirect signal to the United States that it is open to further diplomacy.

“Mr. Zakka was unjustly detained in Iran for almost four years and has endured so much while being held in Iran’s notorious Evin prison,” a State Department spokesman said.

The move to release Zakka comes as U.S.-Iran tensions have soared in the region, following President Trump’s decision last year to withdraw from a nuclear agreement between Iran and world powers. 

The United States has reimposed harsh sanctions on Iran’s economy and threatened to bolster U.S. military assets in the Persian Gulf region to pressure Iran.

“The United States continues to call on the Iranian regime to release missing and wrongfully detained American citizens,” the State Department spokesman said. “We will continue to do all we can to achieve their immediate and unconditional release.”

Iran is holding several dual nationals, including Iranian Americans as well as Chinese-born U.S. citizen and Princeton scholar Xiyue Wang. A court in Tehran convicted two Iranian Americans — Baquer Namazi, 82, and his son, Siamak Namazi — of collaborating with the U.S. government in 2016. Their convictions were upheld this year. 

U.S. Navy veteran Michael White, 46, was arrested in July after traveling to Iran to visit his girlfriend. In 2016, Washington Post correspondent Jason Rezaian, a U.S.-Iranian dual citizen, was released from an Iranian prison after 544 days of captivity. 

Bob Levinson, a former FBI agent, disappeared after traveling to the Iranian resort island of Kish in 2007. His whereabouts are unknown. 

At the time of his arrest, Zakka, who lived in Washington with his wife, was the secretary general of a group called the Arab ICT Organization, or IJMA3, a nonprofit promoting access to information technology in the region. 

He was born in Lebanon but later moved to the United States, attending the Riverside Military Academy in Gainesville, Ga., and pursuing computer science degrees at the University of Texas.

IJMA3 had been awarded $730,000 in grants from U.S. government agencies for projects in the Middle East, the Associated Press reported. It was unclear if any of the U.S.-funded activities were carried out in Iran.

Zakka attended the 2015 conference in Tehran at the behest of Shahindokht Molaverdi, a senior adviser to President Hassan Rouhani and then Iran’s vice president of women and family affairs. 

In an interview with the Associated Press last year, Molaverdi said her government had “failed” to help Zakka and acknowledged that Iran’s civilian leaders have limited power to influence the country’s powerful security forces and hard-line judiciary. 

“This is in no way approved by the government,” Molaverdi told the AP in September. “We did all we could to stop this from happening, but we are seeing that we have failed to make a significant impact.”

Morello reported from Washington. Suzan Haidamous in Beirut contributed to this report.