The Messenger of Allah ﷺ said, "The blood of a Muslim man who bears witness that there is no god but Allah and that I am the Messenger of Allah is not lawful to shed except in one of three cases, the married person who commits adultery, a life for a life, and the one who abandons his religion and separates from the community."
حدثنا عمرو بن عون أخبرنا أبو معاوية عن الأعمش عن عبد الله بن مرة عن مسروق
قال رسول الله ﷺ لا يحل دم رجل مسلم يشهد أن لا إله إلا الله وأني رسول الله إلا بإحدى ثلاث الثيب الزاني والنفس بالنفس والتارك لدينه المفارق للجماعة
Extracted (takhrij): Muslim narrated it in the chapter on Qasamah and Fighters, in the section on what makes a Muslim's blood lawful, hadith no. 1676, from the hadith of Abu Muawiya Dareer. Bukhari narrated it in the chapter on Blood Money, in the section on the saying of Allah Almighty, "Indeed, the soul for the soul..." etc., hadith no. 6878, from the hadith of Amash, with the same chain.