Some Hadiths indicate that apostates and Ghulaat (such as those wo worshipped Imam Ali) are to be executed. Some hadiths indicate that the one who slanders a prophet can also be executed. Here is an example: From Muhammad bin Muslim who said that (Imam) Abu Ja`far (al-Baaqir) (a.s.) said, “Whoever rejects the prophethood of a prophet/messenger and considers him untrue, then his blood is lawful.” Source: Man La Yahdhuruhu ‘l-Faqih, vol. 4, p. 76.

Scholars have diverse understandings about the apostasy and blasphemy. A number of scholars believe that these hadiths were issued in a specific context: in Muslim countries where the truth was shown to people, and the Prophet (s) had shown the truth to everyone. The one who openly slandered the Prophet (s) committed blasphemy and encouraged others to commit blasphemy. This threatened the religious security of those societies, and it would even lead to social disruptions. Therefore, to deter such potential outcomes, the hadiths stated that those who committed such blasphemy or apostasy were to be served capital punishment.

Such laws also have conditions. Are they to be applied in Muslim societies only, or anywhere? Are they to be applied when the truth is clearly known to everyone, or even in an era when there is so much confusion? We cannot simply take these hadiths without understanding their conditions and context. Hence, today our scholars prohibit their followers from killing a person in non-Muslim societies if they slander the holy Prophet (s). And even in Muslim societies there are conditions to be observed.