Iran confirmed on Sunday that it has executed an Iranian nuclear scientist who gave the U.S. intelligence about the country's contested nuclear program.

The official IRNA news agency quoted a spokesman for Iran's judiciary, Gholamhosein Mohseni Ejehi, confirming the execution of Shahram Amiri, an Iranian nuclear scientist caught up in a real-life U.S. spy mystery who later returned to his home country and disappeared. He did say where or when the execution took place, but said Amiri's initial death sentence had been reviewed by an appeal court and that he had access to a lawyer.

Amiri "provided the enemy with vital information of the country," Ejehi said.

Amiri, who worked for a university affiliated to Iran's defense ministry, vanished in 2009 while on a religious pilgrimage to Muslim holy sites in Saudi Arabia, only to reappear a year later in a set of online videos filmed in the U.S. He then walked into the Iranian interests section at the Pakistani Embassy in Washington and demanded to be sent home, returning to a hero's welcome in Tehran.

In interviews, Amiri described being kidnapped and held against his will by Saudi and American spies, while U.S. officials said he was to receive millions of dollars for his help in understanding Iran's contested nuclear program. Now, a year after his country agreed to a landmark accord to limit uranium enrichment in exchange for the lifting of economic sanctions, he has reportedly been hanged without any official word on his case.

"I am a simple researcher who was working in the university," Amiri said on his return to Tehran in July 2010. "I'm not involved in any confidential jobs. I had no classified information."

News about Amiri, born in 1977, has been scant since his return to Iran. Last year, his father Asgar Amiri told the BBC's Farsi-language service that his son had been held at a secret site since coming home.

On Tuesday, Iran announced it had executed a number of criminals, describing them mainly as militants from the country's Kurdish minority. Then, according to Iranian pro-reform daily, Shargh, an obituary notice circulated Amiri's hometown of Kermanshah, a city some 500 kilometers (310 miles) southwest of Tehran, announcing a memorial service on Thursday and calling him a "bright moon" and "invaluable gem."

Manoto, a private satellite television channel based in London believed to be run by those who back Iran's ousted shah, first reported Saturday that Amiri had been executed. BBC Farsi also quoted Amiri's mother saying her son's neck bore ligature marks suggesting he had been hanged by the state.

State media in Iran, which has been silent about Amiri's case for years, did not report his death until Sunday. The Associated Press could not immediately reach his family. Iran's mission to the United Nations did not immediately respond to a request for comment.

It is unclear what would have prompted Iranian authorities to execute Amiri, years after his first disappearance. However, since the nuclear deal, hard-liners within Iran's government have been increasingly targeting dual nationals for arrest in the country and cracking down on journalists, artists, human rights activists and others.

U.S. officials told the AP in 2010 that Amiri was paid $5 million to offer the CIA information about Iran's nuclear program, though he left the country without the money. They said Amiri, who ran a radiation detection program in Iran, stayed in the U.S. for months under his own free will. Analysts abroad suggested Iranian authorities may have threatened Amiri's family back in Iran, forcing him to return.

But when he returned to Iran, Amiri said Saudi and American officials had kidnapped him while he visited the Saudi holy city of Medina. He also said Israeli agents were present at his interrogations and that that CIA officers offered him $50 million to remain in America.

"I was under the harshest mental and physical torture," he said.

Amiri's case indirectly found its way back into the spotlight in the U.S. last year with the release of emails sent by U.S. Democratic presidential candidate Hillary Clinton while she served as secretary of state. The release of those emails came amid criticism of Clinton's use of a private account and server that has persisted into her campaign against Republican candidate Donald Trump.

An email forwarded to Clinton by senior adviser Jake Sullivan on July 5, 2010, appears to reference Amiri.

"We have a diplomatic, `psychological' issue, not a legal one. Our friend has to be given a way out," the email by Richard Morningstar, a former State Department special envoy for Eurasian energy, read. "We should recognize his concerns and frame it in terms of a misunderstanding with no malevolent intent and that we will make sure there is no recurrence.

"Our person won't be able to do anything anyway. If he has to leave so be it."

Another email, sent July 12, 2010 by Sullivan, appears to obliquely refer to the scientist just before his story became widely known.

"The gentleman ... has apparently gone to his country's interests section because he is unhappy with how much time it has taken to facilitate his departure," Sullivan wrote. "This could lead to problematic news stories in the next 24 hours."