Apostasy - the act of a Muslim rejecting Islam - is seen as a crime in classical Islamic law, with the death penalty prescribed.
However, there are strong grounds for accepting that the institutionalisation of this harsh apostasy law is an innovation (bidah) that contradicts both the Qur'an and authenticated Prophetic traditions. The practice appears to have been innovated in the context of the political expansion of Muslim empires after the Prophet.
It is widely known, for instance, that the Qur'an axiomatically establishes in several separate verses the fundamental right to freedom of religious belief:
"Say: The truth is from your Lord. So whoever wills let him believe, and whoever wills let him disbelieve." (18:29)
On the one hand, though, we have this hadith (and variations of it cited elsewhere), cited to justify the death penalty for apostasy:
"Whoever changes his religion, then kill him." (Sahih Bukhari, 6524)
Although by traditional standards this hadith is considered sound, even by traditional standards this is insufficient to justify a hudud penalty, as it is a an ahad (solitary) hadith. According to al-Azhar University's Sheikh Mahmud Shaltut, in his al-Islam: Aqidah wa-Shari’ah, the majority of scholars “are in agreement that the prescribed penalties (hudud) cannot be established by solitary Hadith (ahad), and that unbelief by itself does not call for the death penalty.” (Cited in Prof. Mohammad Hashim Kamali, Freedom of Expression in Islam [Islamic Text Society, 1997])
Other Prophetic traditions - including other hadith from Sahih Bukhari - provide a clearer context, indicating that either the above hadith must be interpreted differently. These hadith prove that the Prophet never applied any penalty at all for apostasy - that is, people who accepted Islam, later rejecting it and becoming non-Muslim.
Jabir reported: A bedouin gave the Pledge of allegiance to Allah's Apostle for Islam. Then the bedouin got fever at Medina, came to Allah's Apostle and said, "O Allah's Apostle! Cancel my Pledge," But Allah's Apostle refused. Then he came to him (again) and said, "O Allah's Apostle! Cancel my Pledge." But the Prophet refused. Then he came to him (again) and said, "O Allah's Apostle! Cancel my Pledge." But the Prophet refused. The bedouin finally went out (of Medina) whereupon Allah's Apostle said, "Medina is like a pair of bellows (furnace): It expels its impurities and brightens and clears its good." (Sahih Bukhari, Vol. 9, 318)
Here, the Prophet offered no penalty for this individual's rejection of Islam.
A more detailed analysis is offered by Ibn Taymiyya. In his contribution to the study Islamic Law and International Human Rights Law (Oxford University Press, 2012), Dr. Abdullah Saeed of the University of Melbourne writes:
"The Prophet did not appear to have treated apostasy as a proscribed offense (hadd), but, on the contrary, pardoned many of the individuals who had embraced Islam, renounced it, and then embraced it again... Ibn Taymiyya, who has recorded this information, added, 'These episodes and similar other ones are well-known to the scholars of hadith.' Ibn Taymiyya further added that the Companions reached consensus on this: for when the Prophet passed away most of the Arabs (except for the residents of Mecca, Medina and Ta'if) apostatized, including many followers of the self-proclaimed 'prophets' Musaylima, al-Ansi, and Tulayha al-Asadi... They were left unharmed, and not a single one was killed because of their renunciation of Islam."
This was also acknowledged by Imam al-Bayhaqi, who wrote:
"Ash-Shafi said: Some people believed and then committed apostasy and then displayed faith again and the Messenger of Allah, peace and blessings be upon him, did not kill them. Ahmad said: We have narrated this regarding Abdullah ibn Abi Sarh when Satan caused him to stumble and he joined the unbelievers, then he returned to Islam. We have also narrated this regarding another man from the Ansar." (al-Bayhaqi, Ma’rifat As-Sunan wal Athar)
The confusion that emerged among later scholars appears because of the equivalence during the Prophet's time between so-called 'major apostasy' and waging war on the Muslim community. Other traditions, however, make clear that the Prophet viewed 'major apostates' for whom a death penalty applied as people who, having embraced Islam and joined the Muslim community with a pledge of allegiance, later waged war on it in an act of treason that violated the treaty or 'Covenant' governing the community. In one hadith, the Prophet defines a 'major apostate' as:
"A man who rejects Islam and wages war against Allah the Exalted and His Messenger." (Sunan An-Nasa’i, 4048)
Providing insight into the view of the Companions on the implications of this, Ibn Abbas is reported to have stated:
"Whoever kills others, spreads corruption in the land, wages war against Allah and His Messenger, and joins the unbelievers before he is subdued, then there is nothing to prevent the legal punishment from being applied to him because of what he did." (Sunan An-Nasa’i, 4046)
Early scholars also recognised this, indicating that the issue was not general apostasy in terms of a Muslim becoming a non-Muslim, but an act of physical war by such a person against the Muslim community:
According to the leading Hanafi scholar Imam al-Kamal ibn al-Humam (Fath ul-Qadir, 6/72):
"It is necessary to punish apostasy with death in order to avert the evil of war, not as punishment for the act of unbelief, because the greatest punishment for that is with Allah. This punishment is specifically for those who wage war and this is for the man. For this reason, the Prophet prohibited killing women because they do not fight."
Here, ibn al-Humam makes clear that the death penalty was only considered valid against an ex-Muslim in the context of their participation in fighting - physically attacking, conducting war against - the Prophet and the Muslim community. As the other hadith from Sahih Bukhari above shows regarding the case of the man who embraced Islam only to reject it, renounce the pledge of allegiance three times, and then leave Medina, the Prophet did nothing - the ex-Muslim was free to disbelieve in Islam, as long as he did not participate in ongoing military campaigns against the Muslim community.
On these grounds, this examination of the Qur'an and hadith on this topic show that there is no sound justification for the death penalty against a Muslim who rejects the Islamic faith.
A compelling summary of all this is provided in the Routledge Handbook of Law and Religion by Abdullah Saeed - Director of the National Centre of Excellence for Islamic Studies and Sultan of Oman Professor of Arab & Islamic Studies at the University of Melbourne:
"There is no evidence to suggest that the Prophet Muhammad himself ever imposed the death penalty on an apostate for the simple act of conversion from Islam. Such penalties were imposed by the Prophet in a number of specific cases, and were related to crimes other than apostasy. Notably, a report in the hadith collection of Bukhari... details a man who came to Medina and converted to Islam. Shortly after his arrival, this man wanted to return to his former religion and asked the Prophet for permission to do so. The Prophet let him go without imposing the death penalty, or any other punishment. In early Islamic history, the question of apostasy appears to have been closely associated with the security of the Muslim community, and was defined in relation to combating treachery and aggression... Unbelief on its own was not used on its own in the Islamic legal tradition as a justification for war or any other form of capital punishment."