The Messenger of Allah ﷺ said, "The blood of a Muslim who testifies that there is no god but Allah and that Muhammad is the Messenger of Allah is not lawful to shed except in one of three cases: a man who commits adultery after marriage, who is to be stoned, a man who goes out to wage war against Allah and His Messenger, who is to be killed, crucified, or banished from the land, or one who kills another person and is killed in retaliation."In another narration, "A man who leaves Islam and wages war against Allah and His Messenger, and is killed."
قال رسول الله ﷺ: لا يحل دم امرئ مسلم يشهد أن لا إله إلا الله، وأن محمدا رسول الله إلا بإحدى ثلاث: رجل زني بعد إحصان فإنه يرجم، ورجل خرج محاربا الله ورسوله فإنه يقتل أو يصلب، أو ينفى من الأرض، أو يقتل نفسا فيقتل بها وفي رواية: رجل يخرج من الإسلام يحارب الله ورسوله فيقتل.
Abu Dawud (4353), Nasai (4048), Daraqutni (3/81), Hakim (4/367), and Bayhaqi (8/283) all narrated it through the route of Ibrahim bin Tahman, from Abdul-Aziz bin Rafi, from Ubayd bin Umayr, from Ayesha, and he related it. Its chain of transmission is sahih. Hakim said, "Its chain is sahih according to the standard of the two Shaykhs."