Yahya related to me from Malik from Zayd ibn Aslam that the Messenger of Allah ﷺ said, "If someone changes his deen - strike his neck!" The meaning of the statement of the Prophet ﷺ in our opinion and Allah knows best, is that "if someone changes his deen, strike his neck!" refers to those who leave Islam for other than it - like the heretics and their like, about whom it is known. They are killed without being called to tawba because their tawba is not recognised. They were hiding their kufr and publishing their Islam, so I do not think that one calls such people to tawba, and one does not accept their word. As for the one who goes out of Islam to something else and divulges it, one calls him to tawba. If he does not turn in tawba, he is killed. If there are people in that situation, I think that one should call them to Islam and call them to tawba. If they turn in tawba, that is accepted from them. If they do not turn in tawba, they are killed. That does not refer as we see it, and Allah knows best, to those who come out of Judaism to Christianity or from Christianity to Judaism, nor to someone who changes his deen from the various forms of deen except for Islam. Whoever comes out of Islam to other than it and divulges that, that is the one who is referred to, and Allah knows best!
أَنَّ رَسُولَ اللَّهِ ﷺ قَالَ مَنْ غَيَّرَ دِينَهُ فَاضْرِبُوا عُنُقَهُ وَمَعْنَى قَوْلِ النَّبِيِّ ﷺ فِيمَا نُرَى وَاللَّهُ أَعْلَمُ مَنْ غَيَّرَ دِينَهُ فَاضْرِبُوا عُنُقَهُ أَنَّهُ مَنْ خَرَجَ مِنَ الإِسْلاَمِ إِلَى غَيْرِهِ مِثْلُ الزَّنَادِقَةِ وَأَشْبَاهِهِمْ فَإِنَّ أُولَئِكَ إِذَا ظُهِرَ عَلَيْهِمْ قُتِلُوا وَلَمْ يُسْتَتَابُوا لأَنَّهُ لاَ تُعْرَفُ تَوْبَتُهُمْ وَأَنَّهُمْ كَانُوا يُسِرُّونَ الْكُفْرَ وَيُعْلِنُونَ الإِسْلاَمَ فَلاَ أَرَى أَنْ يُسْتَتَابَ هَؤُلاَءِ وَلاَ يُقْبَلُ مِنْهُمْ قَوْلُهُمْ وَأَمَّا مَنْ خَرَجَ مِنَ الإِسْلاَمِ إِلَى غَيْرِهِ وَأَظْهَرَ ذَلِكَ فَإِنَّهُ يُسْتَتَابُ فَإِنْ تَابَ وَإِلاَّ قُتِلَ وَذَلِكَ لَوْ أَنَّ قَوْمًا كَانُوا عَلَى ذَلِكَ رَأَيْتُ أَنْ يُدْعَوْا إِلَى الإِسْلاَمِ وَيُسْتَتَابُوا فَإِنْ تَابُوا قُبِلَ ذَلِكَ مِنْهُمْ وَإِنْ لَمْ يَتُوبُوا قُتِلُوا وَلَمْ يُعْنَ بِذَلِكَ فِيمَا نُرَى وَاللَّهُ أَعْلَمُ مَنْ خَرَجَ مِنَ الْيَهُودِيَّةِ إِلَى النَّصْرَانِيَّةِ وَلاَ مِنَ النَّصْرَانِيَّةِ إِلَى الْيَهُودِيَّةِ وَلاَ مَنْ يُغَيِّرُ دِينَهُ مِنْ أَهْلِ الأَدْيَانِ كُلِّهَا إِلاَّ الإِسْلاَمَ فَمَنْ خَرَجَ مِنَ الإِسْلاَمِ إِلَى غَيْرِهِ وَأَظْهَرَ ذَلِكَ فَذَلِكَ الَّذِي عُنِيَ بِهِ وَاللَّهُ أَعْلَمُ