By Roger Hardy
BBC Middle East analyst
Leaving Islam can be fraught with difficulty.
Ayatollah Khomeini said Salman Rushdie must be killed for apostasy
Despite the well-known Quranic injunction "There is no compulsion in religion", issues of religious freedom have persisted into the 21st Century.
A recent report by the New York-based Human Rights Watch (co-authored with the Egyptian Initiative for Personal Rights) throws a spotlight on problems in Egypt.
Suppose a Christian woman converts to Islam, for example when she marries a Muslim man, but later wants to convert back.
Joe Stork of Human Rights Watch relates what happened in one case.
"We had one woman telling us how, when she converted to Islam, it was 'Just hold on, when you've finished your coffee your documents will be ready'.
"But in trying to convert back to Christianity, she's had to go to court - she's been completely frustrated in those efforts."
The problem was aggravated when the Egyptian state computerised identity documents over a decade ago.
Christians seeking to re-convert encountered bureaucratic hassle in getting their ID cards changed.
Egypt's Bahais find it hard to uphold their faith on official papers
Another issue arose from the fact that the state officially recognises only three religions - Islam, Christianity and Judaism.
This put the small Bahai community in an obvious difficulty.
Human-rights groups have welcomed two recent court cases as steps in the right direction.
In one, Bahais were allowed to leave blank the entry for religion on their ID cards.
In the other, a group of Christians seeking to re-convert were told the state should acknowledge their change of status on their identity documents.
Root of the problem
Apostasy - the abandonment of one's faith - is not just a problem in Egypt.
In 2006 an Afghan Muslim who converted to Christianity was sentenced to death and fled to Italy.
Some scholars favour the death penalty; others say the punishment should be left to God on the day of judgement
A new penal code that has been drafted in Iran would, if ratified, formalise the death penalty for apostasy.
The late Ayatollah Khomeini famously denounced the author Salman Rushdie as an apostate for his novel The Satanic Verses - and said he should be killed.
So what is the root of the problem? Why do some Muslim scholars favour such a severe penalty?
Abdal Hakim Murad, a lecturer at the faculty of divinity at Cambridge University, says Islamic law is extraordinarily diverse.
"There's a few things on which everybody agrees - pray five times a day, fast in Ramadan - but, in terms of public law, on most issues there is no consensus."
So some scholars favour the death penalty; others say the punishment should be left to God on the day of judgement.
Dr Murad says he recently attended a conference of Muslim scholars from around the world - and only one took the hard-line view. The others said the death penalty should no longer be applied.
But, for now, the debate goes on - and individuals continue to suffer.