Tunisia's parliament voted to ease the country's harsh drug law to allow first-time offenders, mostly users of cannabis, to avoid jail

Tunisia's parliament voted on Tuesday to ease the country's harsh law on drugs, in a move that could see offenders like youths caught smoking marijuana escape jail terms.

The North African country has faced mounting calls from rights groups and civil society to reform the law.

Tuesday's vote comes after the National Security Council headed by President Beji Caid Essebsi announced in March measures to limit the number of drug-users sent to prison.

Law 52, dating back to the rule of toppled dictator Zine El Abidine Ben Ali, imposes a mandatory one-year jail sentence for narcotics use, ruling out any mitigating circumstances.

Judges were obliged to apply the law, with offenders facing sentences of up to five years in jail.

On Tuesday 133 legislators out of 144 parliamentarians present in the national assembly voted to amend the law, granting judges the power to use their own discretion and take into account mitigating circumstances.

This could mean that some first-time offenders will avoid prison.

Justice Minister Ghazi Jeribi told lawmakers the vote was a "temporary" measure until broader reform of Law 52.

"A considerable step has been taken," lawyer Ghazi Mrabet, who has long campaigned against the harsh terms of the law, said on Facebook.

"Civil society has won the first battle but the fight will continue."

Before Tunisia's 2011 revolution, Law 52 was used to suppress criticism of the Ben Ali regime.

Its application has since become widespread, with thousands of young Tunisians locked up each year, mostly for cannabis-related offences.

Between 2011 and 2016, the number of trials under the law shot up from 732 to 5,744, official figures show.

At the end of December, the government presented a draft amendment to parliament.

The text, which initially provided for the abolition of prison sentences for the first two convictions, is still blocked in the legislature.