Russian MPs have backed an amnesty that may include some of the country's best-known prisoners including Pussy Riot and the Greenpeace Arctic protesters.
The State Duma in Moscow unanimously approved the law at its third reading and it is expected to come into force within days.
It covers at least 20,000 prisoners, including minors, invalids, veterans, pregnant women, and mothers.
Charges against 30 people arrested on a Greenpeace ship may be dropped.
The 30 mostly foreign nationals were recently released from custody but not allowed to leave Russia.
Two members of the Russian punk band Pussy Riot, Maria Alyokhina and Nadezhda Tolokonnikova, were jailed in 2012 for hooliganism motivated by religious hatred after performing an anti-Kremlin protest song in Moscow's Cathedral of Christ the Saviour.
They are due to be released three months from now in any case.
Others who may be freed include some, but not all, of the political protesters arrested during clashes with police after Vladimir Putin's inauguration as Russian president for a third term last year.
One prisoner who will not be affected by the amnesty is former oil tycoon Mikhail Khodorkovsky, who is due for release next August after serving a reduced sentence for theft.
It is also unlikely that opposition leader Alexei Navalny will have his recent five-year suspended sentence for theft quashed.
The amnesty marks the 20th anniversary of Russia's post-Soviet constitution. It will take effect once it is published but the releases are expected to take place over six months.