Iran has some of the toughest antidrug laws in the world, with authorities handing out the death sentence to offenders trafficking or possessing as little as 30 grams of hard drugs like heroin or cocaine.
So it was a major turnaround when the parliament and the Guardians Council, the powerful clerical body that must approve all proposed legislation, abolished the death penalty for some drug-related crimes.
The amendments to the law, which came into effect on November 14, increase the threshold for the use of the death penalty. Capital punishment is reserved for those charged with trafficking 2 kilograms of hard drugs or more than 50 kilograms of cannabis or opium. The death sentence still applies for repeat offenders and lethal drug-related offences.
The changes to the decades-old laws -- expected to curb the number of executions in the Islamic republic, which has one of the highest rates of capital punishment in the world -- have been driven by both international and domestic factors.
President Hassan Rohani, a relative moderate who is early in his second term, has pledged to bring about a general "openness" in Iran, but his efforts to open up political and social space have been contained by hard-liners in the clerical system: the supreme leader, the judiciary, and the Islamic Revolutionary Guards Corps (IRGC).
"The Rohani government wants to show some movement on social and political issues, and so it has pushed the drugs case," says Scott Lucas, an Iran specialist at Birmingham University in Britain and editor of the EA World View website. "With Rohani being constrained on so many political and social questions, it raised the incentive to give him a political win."
Ali Vaez, a senior Iran analyst at the International Crisis Group (ICG), says the move is a "volte-face" and could give Iran an image boost abroad, where it has been accused by Washington of egregious rights violations and by the United States and Mideast rivals of sponsoring terrorism, and has come under pressure over its ballistic-missile program.
"The government would surely welcome any measure that could counter the broad campaign by Iran's adversaries to further demonize it," Vaez says.
There have been growing calls in Iran to ease the use of capital punishment for drug-related offenses. Critics say the extensive use of the death penalty -- including frequent mass hangings that the public is encouraged to attend -- has done little to stop drug use and trafficking in the country, which is on a major transit route for drugs smuggled from Afghanistan.
"[There's a] realization by the Iranian authorities that executions have not been an effective solution to drug trafficking," says researcher Tara Sepehri Far of Human Rights Watch (HRW), which opposes the death penalty. "Several Iranian officials have also spoken about the negative impact of executions on families."
In November 2016, Hassan Nowruzi, a spokesman for the parliament's Judicial Committee, said 5,000 people were on death row for drug-related offenses, the majority of them aged 20-30. He said most were first-time offenders.
A month earlier, more than 150 lawmakers in the 290-member legislature called for a halt to the execution of petty drug traffickers. Lawmakers also suggested that capital punishment should be abolished for those who become involved in drug trafficking out of desperation or poverty.
In August, Mohammad Baqer Olfat, the deputy head of the judiciary's department for social affairs, said the death penalty had not deterred drug trafficking; in fact, he said, it was on the rise. Rather than the death penalty, he suggested, traffickers should be given long prison terms with hard labor.
Iran has been under mounting international pressure to curb its executions. Human rights groups say Iran executed at least 567 people in 2016 and nearly 1,000 in 2015, including a number of migrants from Afghanistan, where the majority of illicit drugs come into Iran. Iranian officials said 70 percent of all executions in the country were for drug-related offenses.
While HRW's Far says it is "disappointing" that the changes do not abolish the death penalty for all nonviolent drug offenses, the move is a "step in the right direction that can potentially save hundreds from death row."
"The sustained international pressure by human rights organizations and UN bodies about the alarming rate of executions in [Iran] has definitely had an impact," Far added.
Magdalena Mughrabi, deputy Middle East and North Africa director at Amnesty International (AI), which is staunchly anti-death-penalty, said that although the changes "may contribute to a drop in the number of executions, it will still condemn scores of people every year to the gallows for offenses that must never attract the death penalty under international law."
Afghan officials and human rights groups have been among the most vocal in calling for reform to Iran's antidrug laws. Thousands of Afghans involved in the illicit narcotics trade have ended up in Iranian prisons and have been executed. Afghanistan is the world's largest producer of opium, which is used to make heroin, and Iran is a major transit route for the drug to western Asia and Europe.