Must the funeral prayer (Salat al-Janazah) be performed for Muslims who committed major sins?
General Chapter
Al-Mughni
Book of Funerals
Primary text
The funeral prayer must be performed for all Muslims, including those who committed major sins, those who were sentenced and executed for adultery (stoning or otherwise), and the offspring of adultery. Imam Ahmad stated that anyone who faces the Qibla and prays our prayer, we pray over them and bury them. The prayer must be performed for someone who withholds Zakat, as there is no known instance where the Prophet (peace be upon him) abandoned the prayer for anyone except a suicide or a ghullul (one who misappropriates spoils of war). This view is held by 'Ata, Al-Nakha'i, Al-Shafi'i, and the Ashab al-Ra'y (Hanafi jurists). The evidence for obligatory prayer for those who profess the Shahada is the Prophet's saying: "Pray over whoever says La ilaha illa Allah."
Supporting text
Abu Hanifa held that the funeral prayer should not be performed for rebels (baghi) or highwaymen (muharibin) because they separate themselves from the community of Islam and resemble the people of the abode of war. Imam Malik held that the prayer should not be performed for someone killed during the execution of a Hadd punishment, citing the report that the Prophet (peace be upon him) did not pray over Ma'iz ibn Malik, although he did not forbid others from praying over him.