Bulugh al-Maram, Book 9, Hadith 1169 (In-Book)

lbn Mas’ud (RAA) narrated that The Messenger of Allah said: “The blood of a Muslim who testifies that none has the right to be worshipped but Allah and that I am His Messenger, cannot be shed lawfully, except in three cases: a married person who committed adultery, in Qisas (retaliation) for murder (life for life) and the apostate from Islam who abandons the Muslim Jama’ah (community).” Agreed upon.

عَنْ اِبْنِ مَسْعُودٍ ‏- رضى الله عنه ‏- قَالَ: قَالَ رَسُولُ اَللَّهِ ‏- صلى الله عليه وسلم ‏-{ لَا يَحِلُّ دَمُ اِمْرِئٍ مُسْلِمٍ; يَشْهَدُ أَنْ لَا إِلَهَ إِلَّا اَللَّهُ, وَأَنِّي رَسُولُ اَللَّهِ, إِلَّا بِإِحْدَى ثَلَاثٍ: اَلثَّيِّبُ اَلزَّانِي, وَالنَّفْسُ بِالنَّفْسِ, وَالتَّارِكُ لِدِينِهِ; اَلْمُفَارِقُ لِلْجَمَاعَةِ } مُتَّفَقٌ عَلَيْهِ 1‏.‏ ‏1 ‏- صحيح.‏ رواه البخاري (6878)‏، ومسلم (1676)‏.‏

sunnah.com

also referenced under: Book 9, Hadith 1199 (English)