Shahram Amiri was initially given a hero’s welcome in Iran, before being accused of spying for Washington.

DUBAI, Aug 7 (Reuters) - Iran has executed an Iranian nuclear scientist detained in 2010 when he returned home from the United States, after a court convicted him of spying for Washington, a spokesman for the judiciary said on Sunday.

“Through his connection with the United States, (Shahram) Amiri gave vital information about the country to the enemy,” Gholamhossein Mohseni Ejei told a weekly news conference, state news agency IRNA reported.

Mohseni Ejei said a court had sentenced Amiri to death and the sentence had been upheld by Iran’s Supreme court, IRNA said.

Amiri, a university researcher working for Iran’s Atomic Energy Organization, disappeared during a pilgrimage to Saudi Arabia in 2009, and later surfaced in the United States. But he returned to Iran in 2010 and received a hero’s welcome before being arrested.

A U.S. official said in 2010 that Washington had received “useful information” from Amiri.

Iran had accused the CIA of kidnapping Amiri. U.S. officials said Amiri had been free to come and go as he pleased, and that he may have returned because of pressures on his family in Iran.

Amiri had denied this, saying “my family had no problems.” In a video aired by Iranian state TV in 2010, Amiri said he had fled from U.S. agents.

Iran, the United States and five other world powers reached a landmark deal last year, under which Iran agreed to limit its nuclear program in such a way as to ensure it cannot develop nuclear weapons in exchange for a lifting of economic sanctions.