How to supplicate for a dead person

Q 5: The Messenger (peace be upon him) advised sincerity when making Du‘a’ (supplication) for a dead person in the third Takbir (saying: "Allahu Akbar [Allah is the Greatest]") of the Funeral Prayer. Should this be only done for a Muslim that we know or for all the dead, as sometimes we offer the Funeral Prayer at the time of every Salah (Prayer), as happens now, and we do not know if the dead person is a Muslim or not?

A: Funeral Prayer should only be offered for Muslims. A person is judged to be a Muslim as long as they apparently adhere to the rituals of Islam, without looking into what they inwardly hide. As long as someone appears to have been adhering to the laws of Islam and we have not learned that they have committed any form of major Shirk (associating others with Allah in His Divinity or worship) that nullifies their Islam, we should offer the Funeral Prayer for them and supplicate to Allah sincerely for them. If the reality of the deceased is hidden from some Muslims, those who do not know the deceased should offer the Salah for them, following those among the congregation who know them. If anybody dies and is brought to the Masjid (mosque) for a Funeral Prayer, the Muslims should offer the Salah for them with those who know them, acting upon what is apparent.May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.