Praise be to Allah
It is permissible to mourn a disbeliever if he died following something other than the religion of Allah, if that is by way of overwhelming general human compassion, such as mourning one’s father or brother if he died following a religion other than Islam, or if this man was someone who did great charity work or was someone who helped people and was of good character, and other virtues that people may have, but do not follow the religion of Islam, and they are not hostile towards Islam and its people.
This comes under the general heading of compassion for which a person cannot be blamed, just as he cannot be blamed for his sorrow at the death of a disbeliever who dies in front of him in an accident or a fire and the like.
This is like when the Prophet (blessings and peace of Allah be upon him) grieved for his mother and wept for her, as Muslim (976) narrated that Abu Hurayrah said: The Prophet (blessings and peace of Allah be upon him) visited his mother’s grave; he wept and caused those who were around him to weep, and he said: “I asked my Lord for permission to pray for forgiveness for her, but He did not grant me permission. And I asked Him for permission to visit her grave and He gave me permission, so visit graves, for they will remind you of death.”
Ibn Abi Shaybah (11808) narrated from Sulaymaan ibn Buraydah that his father said: When the Messenger of Allah (blessings and peace of Allah be upon him) conquered Makkah, he came to a grave and sat beside it and appeared to be addressing someone. The people sat around him, then he stood up weeping. ‘Umar came to him, and he was one of the boldest in speaking to him. He said: May my father and mother be sacrificed for you, O Messenger of Allah! What is it that has made you weep? He said: “This is the grave of my mother. I asked my Lord to let me visit it, and He gave me permission. I asked Him to let me pray for forgiveness for her, but He did not give me permission. I remembered her and felt sad, so I wept.” There was never a day on which he wept more than on that day.
Classed as saheeh by al-Albaani in al-Irwa’ (3/225)
Similarly, the Prophet (blessings and peace of Allah be upon him) mourned the death of his paternal uncle in a state of disbelief, as he had hoped that he would become Muslim, and he prayed to Allah for him until he was forbidden to do so.
But if the grief for him is contrary to disavowal of the mushrikeen, or is contrary to what is implied by disavowal of the mushrikeen and their religion, and resentment towards what they follow of disbelief in Allah, or it is taking lightly their disbelief in the Lord of the Worlds and their ascription of partners to Him, or it is accompanied by belief that what they did of good deeds in this world will intercede for them despite their disbelief, or other corrupt beliefs, then this grief is prohibited and invalid, and it is a shortcoming in one’s belief in al-wala’ wa’l-bara’ (loyalty and friendship towards believers and disavowal and enmity towards disbelievers) and what this implies.
In the answer to question no. 154727 we stated that rejoicing over the death of the enemies of Islam, the followers of extreme innovations and those who openly commit evil, is something that is prescribed in Islam.
And Allah knows best.