Praise be to Allah.
It is not permissible to offer the funeral prayer for a polytheist, a disbeliever or a hypocrite who is guilty of major hypocrisy. If a person is aware of somebody’s hypocrisy or disbelief, it is prohibited for him to offer the funeral prayer for him or to pray for forgiveness for him after his death, regardless of whether or not he was a relative of his.
Abu Ishaaq ash-Shiraazi (may Allah have mercy on him) said in al-Muhadhdhab (1/250):
If a disbeliever dies, the funeral prayer should not be offered for him because Allah, may He be glorified and exalted, says (interpretation of the meaning):
“And never (O Muhammad (blessings and peace of Allah be upon him)) pray (funeral prayer) for any of them (hypocrites) who dies, nor stand at his grave”
That is because the prayer is offered to seek forgiveness, but the disbeliever cannot be forgiven, so there is no point in praying for him.
An-Nawawi (may Allah have mercy on him) said:
They are unanimously agreed that it is prohibited to offer the funeral prayer for a disbeliever. End quote.
It says in al-Mawsoo‘ah al-Fiqhiyyah (41/21):
The Prophet (blessings and peace of Allah be upon him) used to offer the funeral prayer for the hypocrites and pray for forgiveness for them, until the following verse was revealed (interpretation of the meaning):
“Whether you (O Muhammad (blessings and peace of Allah be upon him)) ask forgiveness for them (hypocrites) or ask not forgiveness for them (and even) if you ask seventy times for their forgiveness Allah will not forgive them”
So he did not offer the funeral prayer for them after that, and he did not pray for forgiveness for them.
If one of them died, the Muslims would offer the funeral prayer for anyone who they did not know to be a hypocrite, but if it was known that he was a hypocrite, the funeral prayer would not be offered for him.
If someone died, ‘Umar (may Allah be pleased with him) would not offer the funeral prayer for him unless Hudhayfah did so, because Hudhayfah knew exactly who the hypocrites were. End quote.
When the Prophet (blessings and peace of Allah be upon him) prayed for forgiveness for Abu Taalib after his death, Allah told him not to do that, and said (interpretation of the meaning):
“It is not (proper) for the Prophet and those who believe to ask Allah’s Forgiveness for the Mushrikoon (polytheists, idolaters, pagans, disbelievers in the Oneness of Allah) even though they be of kin, after it has become clear to them that they are the dwellers of the Fire (because they died in a state of disbelief).
And (Ibraheem’s (Abraham)) invoking (of Allah) for his father’s forgiveness was only because of a promise he (Ibraheem (Abraham)) had made to him (his father). But when it became clear to him (Ibraheem (Abraham)) that he (his father) is an enemy to Allah, he dissociated himself from him. Verily Ibraheem (Abraham) was Al-Awwah (has fifteen different meanings but the correct one seems to be that he used to invoke Allah with humility, glorify Him and remember Him much), and was forbearing”
The same applies to the magician who seeks the help of the jinn in doing his magic; he is a disbeliever and it is not permissible to offer the funeral prayer for him.
Shaykh Ibn Baaz (may Allah have mercy on him) was asked about the ruling on offering the funeral prayer for a magician and burying him in the Muslim graveyard after he is executed.
If he is executed, the funeral prayer should not be offered for him and he should not be buried in the Muslim graveyard. He should be buried in the graveyard of the disbelievers, and not in the graveyard of the Muslims. The funeral prayer should not be offered for him, and he should not be washed or shrouded. End quote.
Majmoo‘ Fataawa Ibn Baaz (8/111); see also fatwa no. 13941
With regard to the questioner saying: no one knows that this person was a hypocrite or a magician or a mushrik except him, this maycome under the heading of making hasty accusations, and what is required is to ascertain the facts. He may have been deemed a hypocrite because of his having one of the signs of the hypocrites, such as lying when he speaks, but this is not sufficient to put a Muslim beyond the faith and rule that he is a hypocrite in terms of his beliefs.
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said:
Hypocrisy is of two types: hypocrisy in belief and hypocrisy in action. The site of hypocrisy in belief is the heart, and no one knows it except Allah. Therefore when one of the Sahaabah committed some error and ‘Umar said: He is a hypocrite, the Messenger (blessings and peace of Allah be upon him) disagreed with him.
The site of hypocrisy in belief is the heart, and it is not permissible for one to accuse any of the Muslims, those who show loyalty to Allah and His Messenger, of this except on the basis of clear evidence.
With regard to hypocrisy in terms of deeds, if a person demonstrates one of the characteristics of the hypocrites, there is nothing wrong with saying that he is a hypocrite because of this action. So if we see a man speaking and lying, we may say that he is a hypocrite in the sense of hypocrisy in action with regard to this matter. And if we see him standing to pray in a lazy manner, we may say that he has one of the characteristics of the hypocrites, because he resembles the hypocrites by standing to pray in a lazy manner. Hypocrisy in action is a matter that is broad in scope, so whoever acts like the hypocrites in one of their characteristics, is a hypocrite in terms of this action in particular. As the Messenger (blessings and peace of Allah be upon him) said: “The signs of the hypocrite are three: when he speaks he lies, when he makes a promise he breaks it, and when he is entrusted with something he breaks that trust.”
These are the signs of the hypocrite, but these signs may be present in any Muslim people. Therefore we say that he is a hypocrite in terms of this matter only. End quote.
Liqa’ al-Baab al-Maftooh (32/21)
So it is not permissible to accuse someone of hypocrisy in terms of belief that puts one beyond the pale of Islam, except on the basis of clear evidence.
And Allah knows best.