Ikrima reported,

Some heretics were brought to Ali رضي الله عنه, and he had them burned. When news of this reached Ibn Abbas, he said, "Had it been me, I would not have burned them, because of the prohibition of the Messenger of Allah ﷺ, 'Do not punish with the punishment of Allah.' Rather, I would have killed them, in accordance with the words of the Messenger of Allah ﷺ, 'Whoever changes his religion, kill him.'"

Bukhari 6922

Sahih

حدثنا أبو النعمان محمد بن الفضل حدثنا حماد بن زيد عن أيوب

عن عكرمة قال

أتي علي رضي الله عنه بزنادقة فأحرقهم فبلغ ذلك ابن عباس فقال لو كنت أنا لم أحرقهم لنهي رسول الله ﷺ لا تعذبوا بعذاب الله ولقتلتهم لقول رسول الله ﷺ من بدل دينه فاقتلوه

البخاري 6922صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Demanding repentance from apostates and obstinate disbelievers and fighting them
Chapter
Ruling on the male and female apostate
Numbering
Darussalam 6922
Bukhari 6922