The announcement of the mass release came just hours after Hasan Rouhani departed for New York for the annual UN General Assembly, where he is expected to seek Western pledges to restart stalled talks over Iran's nuclear programme.
It appeared to reinforce the impression that Rouhani has support from the country's Supreme Leader Ayatollah Ali Khamenei to explore a broad rapprochement with the West, which has condemned Iran's crackdowns on the opposition.
Rouhani has repeatedly appealed to the US and allies to roll back sanctions to move ahead negotiations.
The official IRNA news agency said Khamenei agreed to a request from the judiciary to release the opposition supporters and others jailed on security charges. Khamenei has apparently backed Rouhani's attempts to repair ties with the West and possibly open groundbreaking dialogue with Washington.
Last week, Iran released a dozen prominent political prisoners, including a human rights lawyer. But the main opposition leaders Mir Hossein Mousavi and Mahdi Karroubi remain under house arrest.
