Italy's constitutional court has overturned a law that tripled sentences for selling, cultivating and possessing cannabis, declaring it "illegitimate".
Prison rights group Antigone say the law has caused prison overcrowding, with 40% of all inmates serving sentences for drug crimes.
It could affect some 10,000 people who may be released from jail as a result.
The law went into effect in 2006 under the conservative government led by the then-Prime Minister, Silvio Berlusconi.
Italian jails are considered to be the most crowded in the European Union.
According to official data, cited by Reuters news agency, around 62,000 detainees are held in cells built for fewer than 48,000.
In January 2013, the European Court of Human Rights ruled that overcrowding in Italy's jails violates the basic rights of inmates. The Italian authorities were fined 100,000 euros ($135,700, £81,934) and ordered to solve the overcrowding issue within a year.
Under the stricter drugs law, lighter drugs such as cannabis and hashish were classified as equal, in legal terms, to Class A drugs cocaine and heroin.
This increased the sentences for the cultivation, sale and trafficking of cannabis from 2-6 years to 6-20 years.
Following the court's ruling, the previous drug law giving reduced sentences automatically takes effect.
Neither law made it a criminal offence to consume cannabis but both criminalised its possession.
The ruling by the constitutional court has split parties "left and right", Italy's Ansa news agency reports.
"The ruling puts the final word on one of the most absurd laws that parliament has ever passed in recent years," said Alessia Morani, an MP with the centre-left Democratic Party (PD).
But other MPs, such as Maurizio Gasparri, said the ruling was "a big mistake that risks promoting dealing and consuming drugs," Ansa reported.