Iran has released on bail the last of three Iranian-Americans whom it had detained on security grounds, judicial sources in Tehran say.
Ali Shakeri was arrested in May as he was about to leave Iran
California-based peace activist Ali Shakeri was bailed for a billion riyals ($100,000), the sources said.
He would need special permission from a judge if he wanted to leave Iran, the sources added.
He was arrested in May along with academics Haleh Esfandiari and Kian Tajbakhsh who were also freed recently.
News of his release came just ahead of a scheduled address by President Ahmadinejad to the United Nations General Assembly.
A fourth Iranian-American, journalist Parnaz Azima, was kept in Iran for eight months after her passport was confiscated. She was also allowed to return to the US a week ago.
The detentions increased tension between the US and Iran, which Washington accuses of seeking a clandestine nuclear arms capability and fuelling violence in Iraq. Iran denies both accusations.
Mr Shakeri, of the University of California's Center for Citizen Peacebuilding, was arrested in May as he was about to leave Iran and taken to Evin prison.
He had travelled to the country two months earlier to visit his ailing mother.
New York-based group Human Rights Watch said the 59-year-old had been held in solitary confinement at Evin for more than four months without charge.
Ms Esfandiari was released on bail in August and was allowed to return to the US earlier in September. Mr Tajbakhsh was also released on bail last week.
The BBC's Pam O'Toole says there had been suggestions the dual nationals' continued detentions might have embarrassed Mr Ahmadinejad during his visit to New York.
Iranian media had accused them of spying for the US and Israel, but there is no indication any of them were charged.