The majority of Muslim scholars are of the opinion that a funeral prayer may be offered for a person who is convicted of embezzlement of public funds, or commits suicide or some similarly sinful act.
An-Nawawi said: “Al-Qadi said: ‘All Muslim scholars hold that a funeral prayer be offered for all Muslims – those sentenced to death under Islamic law, or stoned to death, or those who committed suicide, or were born out of wedlock. The reports about the Prophet, peace be upon him, not praying for embezzlers and those guilty of suicide may be explained perhaps by considering such refusal to be a form of reprimand to these people. This is similar to his practice of refusing to pray for those who died in debt, though he asked other Muslims to offer the funeral prayer for them’.”
Ibn Hazm said: “Funeral prayer should be offered for all Muslims, whether good or bad, including those sentenced to death and those that die fighting or in revolt. The imam, or any one other than him, may lead the funeral prayers. Likewise funeral prayers should be said for an innovator, provided his innovation does not become blasphemy, and prayer may also be said for one who commits suicide or kills some one else. A funeral prayer may be offered in all such cases even though the deceased might have been the most evil person on the face of the earth, provided he dies as a Muslim. This is based on a hadith from the Prophet, peace be upon him, that has a general bearing. “Offer a funeral prayer for your friend (a fellow Muslim),” he is reported to have said on the death of a Muslim. All Muslims are friends to one another. The Qur’an says: “Verily! The believers are but a single brotherhood” Qur’an 49.10 and “The believers, men and women, are protectors, one of another.” Qur’an 9.71
To prevent others from offering funeral prayers over a Muslim is a most serious thing, for surely a sinful Muslim is more in need of prayers from his Muslim brothers than a pious and saintly person!
An authentic hadith records that a man died in Khayber, and the Prophet, peace be upon him, said: “Offer a funeral prayer for your friend. He has stolen something of the war booty.” The Muslims searched the deceased’s personal effects and found less than two dirham worth of beads in them.
In another sahih hadith ‘Ata reported that a funeral prayer may be offered for an illegitimate child, and his mother, and for those who curse each other, (In cases of Lu’an, for instance, when in the absence of any evidence of a spouse’s adultery both the man and wife are required to swear an oath that he/she is telling the truth or face being cursed by Allah if they were lying) as well as the person who is killed in requital, and the person stoned to death, and the person who flees from the battlefield and is put to death for it. ‘Ata said: “I will never abstain from offering a funeral prayer for a person who says: ‘I bear witness that there is no deity except Allah.’ Allah says: ‘It is not fitting for the Prophet and those who believe to pray for forgiveness for pagans, even though they be of kin, after it is clear that they are companions of the Fire.’ – Qur’an 9.113
Another authentic hadith says that Ibrahim An-Nakh’i said: “Our predecessors never eschewed attending a funeral prayer for any Muslim. They offered the funeral prayer for those who had committed suicide, and it is a sunnah to offer funeral prayer for those who are stoned to death.” In another sound hadith Qatadah reported: “I do not know of any scholar who refused to offer a funeral prayer for anyone witnessing that ‘there is no god but Allah’.” Ibn Sirin, according to a sahih hadith, said: “I do not know of any Muslim who considers it a sin to offer a funeral prayer for another Muslim.”
Abu Ghalib reported: “I asked Abu Amamah Al-Bahili: ‘What if a man is known to drink liquor. Should a funeral prayer be offered for him?’ He said: ‘Yes, for he might [at least] once in his life, while lying down for rest, have said: “There is no deity but Allah,” and he might have been forgiven by Allah.” In a sahih hadith Al-Hasan is reported to have said: “Funeral prayer will be offered for all those who declare ‘There is no deity but Allah.’ It will be offered for all Muslims; for it is an act of intercession on behalf of the deceased.”