Mohamed Cheikh Ould Mohamed, who is around 30 years old, fainted when the ruling was read out late Wednesday in a court in Nouadhibou in the northwest of the country, the source said on condition of anonymity.
He was revived and taken to prison, the source added. Mohamed has been detained since January 2 and pleaded not guilty to the charge when proceedings opened on Tuesday.
Mauritania has the death penalty but has not executed anyone since 1987, according to human rights organisation Amnesty International.
During the hearing the judge told Mohamed that he was accused of apostasy “for speaking lightly of the Prophet Mohammed” in an article which was published briefly on Mauritanian websites. In it he challenged some of the prophet’s actions, the source told AFP.
Mohamed explained that it was “not his intention to harm the prophet”, the source added. His lawyer asked for leniency as he said his client was repentant but the judge agreed to the prosecutor’s request for the death penalty.
Sharia, or Islamic, law is in effect in Mauritania but the enforcement of strict punishments — such as floggings — have been rare since the 1980s.