A Mauritanian blogger who was jailed for more than five years after being convicted of blaspheming the Muslim Prophet Muhammad has been released.
Rights groups had waged a long campaign to secure Mohamed Cheikh Ould Mohamed M'khaitir's release.
He had been due for release in 2017 but the government refused saying he could be lynched.
Conservative Muslims had demanded his execution for a Facebook post he wrote about the Prophet Muhammad.
In the post from 2014, M'khaitir had questioned the choices made by the Prophet Muhammad during holy wars in the 7th Century.
He also lashed out at the mistreatment of black Mauritanians who M'khaitir argued were discriminated against.
He was convicted of blasphemy that same year and sentenced to death, but the sentence was commuted to two years in jail after an appeal.
He should have been released in 2017 because he had already spent two years in jail, but crowds of conservative Muslim protesters called for his execution forcing authorities to detain him on "security grounds".
M'khaitir made statements of repentance on Facebook and TV as a condition of his release after a meeting between rights groups, religious leaders, and outgoing President Mohamed Ould Abdel Aziz, said rights group Reporters Without Borders.
"This blogger was francophone Africa's longest-held citizen-journalist. We thank all those who contributed to his release," said Christophe Deloire, the group's secretary-general.
Mauritania has since amended its criminal code and the death penalty is now mandatory for anyone convicted of what is seen as blasphemous speech.