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.
English reference: Book 9, Hadith 1199
Arabic reference: Book 9, Hadith 1169