Tunisians convicted of cannabis consumption will be able to avoid prison if it is their first offence, under new regulations issued on Wednesday.

The North African country has faced mounting calls from rights groups to reform a law that jails youths for a year for smoking a joint.

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

But the National Security Council headed by President Beji Caid Essebsi on Wednesday announced measures to limit the number of users sent to prison.

For a first conviction, judges will be able to issue a pardon as soon as the judgment is pronounced.

The new measures will take effect on Monday, Tunisia's independence day. Before Tunisia's 2011 revolution, Law 52 was used to suppress criticism of the Ben Ali government.

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 skyrocketed 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.

Yosra Frawes of the International Federation for Human Rights (FIDH) said the new measures were "a step forward".

"It was not logical to tie the hands of the judges" by not allowing them to take extenuating circumstances into account, she said.

The changes "will avoid thousands of imprisonments," said lawyer Ghazi Mrabet.

"But they also mean that it will be case by case and judges will still be able to send people to prison."