´It was narrated from Anas that :` Some people of Az-Zutt, who worshipped idols, were brought to 'Ali, and he burned them. Ibn 'Abbas said: "But the Messenger of Allah [SAW] said: 'Whoever changes his religion, kill him.'"
Hadith Referenceسنن نسائي / كتاب تحريم الدم / 4070
1؎: This action of Ali (radi Allahu anhu) was based on his own opinion and ijtihad (independent juristic reasoning). That is why, when the hadith narrated from Ibn Abbas (radi Allahu anhuma) reached him, he retracted from his previous position. (Wallahu a‘lam)