Women cross a street near a giant political mural depicting Ayatollah Ali Khamenei, Iran's supreme leader, left, and Ruhollah Khomeini, founder of the Islamic republic of Iran, in Tehran, Iran, on Wednesday, May 9, 2018.

Iran has agreed to hand over a U.S. permanent resident imprisoned for years in Tehran to Lebanese officials, an Iranian judiciary official said Tuesday, providing the first official confirmation that Nizar Zakka would be sent back to his native Lebanon.

The comment by judiciary spokesman Gholamhossein Esmaili comes as a top Lebanese security official is in Tehran to secure Zakka's release, which has been anticipated for days.

"A court has accepted the condition of freedom of Nizar Zakka and he will be handed over to Lebanese officials," Esmaili said, according to the judiciary's Mizan news agency.

There was no immediate comment from Lebanon.

Zakka, an internet freedom advocate, is one of a series of prisoners with either dual nationality or links to the West held in Iran. His potential release comes as tensions between Iran and the U.S. remain high after President Donald Trump withdrew America from Tehran's nuclear deal with world powers.

A report Monday on state TV's website mirrored a report earlier carried by the semi-official Fars news agency about Zakka, who was arrested in September 2015 while trying to fly out of Tehran. He had just attended a conference there on the invitation of one of the country's vice presidents.

State TV, like Fars, both quoted an anonymous source saying Zakka's forthcoming release should only be seen as a "sign of respect" for the Lebanese militant Hezbollah group and its leader, Hassan Nasrallah.

"In this regard, no negotiations have taken place at any level with any person or any government," state TV said.

Esmaili stressed Zakka's release was within "the frame of the law."

"We reviewed the (Lebanese) president's request through the Supreme National Security Council" Esmaili said. "Also, the Lebanese Hezbollah group considered the approval of his freedom as prudent."

State TV later quoted an anonymous source as saying Zakka would be released on Tuesday afternoon and will be allowed to leave Tehran.

In 2016, Iran sentenced Zakka to 10 years in prison. Authorities accused him of being an American spy, allegations vigorously rejected by his family and associates.

Zakka, who lives in Washington and holds resident status in the U.S., leads the Arab ICT Organization, or IJMA3, an industry consortium from 13 countries that advocates for information technology in the region.

In 2016, The Associated Press reported that Zakka's supporters wrote to then-Secretary of State John Kerry, stating Zakka travelled to Iran "with the knowledge and approval of the U.S. State Department, and his trip was funded by grants" from it.

Zakka's IJMA3 organization had received at least $730,000 in contracts and grants since 2009 from both the State Department and USAID, the lead American government agency fighting poverty and promoting democracy across the world.

The State Department has yet to respond to a years-old request from the AP for information about those grants.

Shahindokht Molaverdi, an adviser to President Hassan Rouhani who as a vice president invited Zakka to Iran, told the AP in September that Iran's government had "failed" to help Zakka.

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