An Iranian policeman stands guard as 50 tonnes of illegal drugs are destroyed

Thousands on death row for drug crimes in Iran will escape hanging as a new softened anti-narcotics law is enforced, local media reported on Wednesday.

Judiciary chief Ayatollah Sadegh Larijani on Tuesday ordered judges to halt death sentences for concerned convicts and review their cases, the judiciary's Mizanonline news agency said.

The new law retroactively "clarifies the fate of some 5,000 sentenced to death for drug trafficking", the Iran daily newspaper quoted Larijani as saying in a directive.

Most convicts will see their death sentences commuted to jail terms of between 25 to 30 years, he said.

Iran does not provide official figures on executions, but human rights group Amnesty International says it was the world's second top executioner in 2016 after China, with most of its hangings related to drug trafficking.

Parliament passed the amended drug law in August after years of internal debate between police, the judiciary and lawmakers.

The new law raises the amounts that can trigger the death penalty from 30 grams to two kilos for the production and distribution of chemical substances such as heroin, cocaine and amphetamines.

For natural substances such as opium and marijuana, the levels have been raised from five to 50 kilos.

The amendment maintains the death penalty for those who lead drug-trafficking gangs, exploit minors below 18 years old in doing so, or carry or draw firearms while committing drug-related crimes.

Iran's neighbour Afghanistan produces some 90 percent of the world's opium, which is extracted from poppy resin and refined to make heroin.

The Islamic republic, a major transit point for Afghan-produced opiates heading to Europe and beyond, confiscates and destroys hundreds of tonnes of illicit narcotics every year.