Despite a tough law against slavery passed in 2007 allowing slaveholders to be prosecuted, those who protest the practice may still wind up in jail, in some cases for years.

This month, three activists, arrested at an antislavery demonstration, had their sentence of two years behind bars upheld by a Mauritanian court. They were found guilty of belonging to an illegal organization, leading an unauthorized rally and violence against the police.

Biram Ould Abeid, one of the three sent to jail, is the most prominent antislavery activist in Mauritania and was runner-up in the 2014 presidential elections. He is also the founder of the Initiative for the Resurgence of the Abolitionist Movement. From jail, he vowed to continue his fight and urged the U.S. and European Union to end financial aid to the country.

“From my dark cell, I urge them to mobilize all legal and diplomatic means, including the suspension of all financial aid, to push the government to take real action to eradicate slavery as well as the racism and exclusion underlying it,” wrote Ould Abeid.

The two others convicted were Brahim Bilal Ramdane, an assistant to Ould Abeid, and Djiby Sow, a civic and cultural rights campaigner.

Sow has since been released on parole because of health problems.

“This is a step backwards for freedom in our country, an example of judicial authorities’ submissiveness to executive orders,” said defense lawyer Brahim Ould Ebetty, who boycotted the hearing along with his clients.

“The conviction of these activists for taking part in peaceful protests on charges which are vague and open to abuse violates their human rights to free expression and freedom of peaceful assembly,’’ said Gaetan Mootoo, a West Africa researcher for Amnesty International. “Their conviction appears to be politically motivated, with members of the group targeted on account of their peaceful activism.”

The government of President Mohamed Ould Abdel Aziz, a former military officer who took power in a 2008 coup, accuses the activists of spreading “racist propaganda.”

The Global Slavery Index estimates that at least 140,000 people are in bondage in Mauritania, out of a population of 3.8 million. But there has been only one successful conviction since slavery was outlawed 18 years ago.

Members of the Haratine ethnic group, former slaves, suffer degrading treatment and are excluded from education and politics. They are prohibited from owning land or inheriting property.

“We are reaching a point where it’s hard to see how we can peacefully regain our rights,” said Ibrahima Ndiaye from Nouakchott, in an interview with Monica Mark, West Africa correspondent with The Guardian newspaper.