عَنِ ابْنِ عُمَرَ قَالَ لَمَّا مَاتَ عَبْدُ اللَّهِ بْنُ أُبَيٍّ جَاءَ ابْنُهُ إِلَى رَسُولِ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَآلِهِ وَسَلَّمَ فَقَالَ يَا رَسُولَ اللَّهِ أَعْطِنِي قَمِيصَكَ حَتَّى أُكَفِّنَهُ فِيهِ وَصَلِّ عَلَيْهِ وَاسْتَغْفِرْ لَهُ فَأَعْطَاهُ قَمِيصَهُ وَقَالَ آذِنِّي بِهِ فَلَمَّا ذَهَبَ لِيُصَلِّيَ عَلَيْهِ قَالَ يَعْنِي عُمَرَ قَدْ نَهَاكَ اللَّهُ أَنْ تُصَلِّيَ عَلَى الْمُنَافِقِينَ فَقَالَ أَنَا بَيْنَ خِيَرَتَيْنِ اسْتَغْفِرْ لَهُمْ أَوْ لَا تَسْتَغْفِرْ لَهُمْ [التوبة: 80] فَصَلَّى عَلَيْهِ فَأَنْزَلَ اللَّهُ تَعَالَى وَلَا تُصَلِّ عَلَى أَحَدٍ مِنْهُمْ مَاتَ أَبَدًا [التوبة: 84] قَالَ فَتُرِكَتِ الصَّلَاةُ عَلَيْهِمْ
It is narrated from Sayyiduna Abdullah bin Umar (may Allah be pleased with him) that when Abdullah bin Ubayy, the hypocrite, died, his son Sayyiduna Abdullah (may Allah be pleased with him), who was a Muslim, came to the Noble Prophet (peace and blessings be upon him) and said: O Messenger of Allah! Grant me your shirt so that I may shroud my father in it, and lead his funeral prayer, and seek forgiveness for him. The Prophet (peace and blessings be upon him) gave him his shirt and said: Inform me at the time (of the funeral). When the Prophet (peace and blessings be upon him) stepped forward to lead the prayer, Sayyiduna Umar (may Allah be pleased with him) said: Allah Almighty has forbidden you from performing the funeral prayer for the hypocrites. The Prophet (peace and blessings be upon him) replied: I have been given a choice; Allah Almighty has said: Whether you seek forgiveness for them or do not seek forgiveness for them. So the Prophet (peace and blessings be upon him) led the funeral prayer, and then Allah Almighty revealed this command: {وَلَا تُصَلِّ عَلٰی أَحَدٍ مِنْہُمْ مَاتَ أَبَدًا} … And never pray the funeral prayer for any of them who dies.
Brief Explanation
Benefits: … After the return from the Battle of Tabuk, in Dhu al-Qa'dah 9 AH, the chief of the hypocrites, Abdullah bin Ubayy, died. Since his son was a sincere Muslim, he requested the Noble Prophet sallallahu alayhi wa sallam for his shirt and for leading the funeral prayer, so that the punishment might be averted from him, but his objective was not fulfilled.
There are further opinions regarding the giving of the shirt, for example: (1) Abdullah bin Ubayy had done a favor to you sallallahu alayhi wa sallam, and you sallallahu alayhi wa sallam wished to repay his favor; (2) This was actually an expression of your sallallahu alayhi wa sallam’s compassion so that his son’s heart might be reconciled and his tribe, Khazraj, might also be satisfied, and so on.
It is understood from this that it is prohibited to perform the funeral prayer for a disbeliever, polytheist, or hypocrite, and to supplicate for their forgiveness.
The following narration provides detail:
It is narrated from Sayyiduna Umar bin Khattab radi Allahu anhu that when Abdullah bin Ubayy, the hypocrite, died, the Noble Prophet sallallahu alayhi wa sallam was called for his funeral prayer. You sallallahu alayhi wa sallam came, and when you sallallahu alayhi wa sallam intended to perform his funeral prayer, I turned and stood before you sallallahu alayhi wa sallam and said: O Messenger of Allah! Upon Allah’s enemy? Will you perform the funeral prayer for Abdullah bin Ubayy? He said such-and-such on such-and-such a day, and I began to enumerate each day on which he had plotted against Islam, while the Messenger of Allah sallallahu alayhi wa sallam was smiling. When I insisted further, you sallallahu alayhi wa sallam said: O Umar! Step back. I have been given the choice to perform the funeral prayer or not, and I have chosen to perform it. It has been said to me: {اسْتَغْفِرْ لَہُمْ أَوْ لَا تَسْتَغْفِرْ لَہُمْ إِنْ تَسْتَغْفِرْ لَہُمْ سَبْعِینَ مَرَّۃً فَلَنْ یَغْفِرَ اللّٰہُ لَہُمْ} … (Whether you ask forgiveness for them or do not ask forgiveness for them, even if you ask forgiveness for them seventy times, Allah will never forgive them.) And if I knew that if I sought forgiveness for him more than seventy times, he would be forgiven, I would seek forgiveness for him that many times. Then you sallallahu alayhi wa sallam performed his funeral prayer and even walked to his grave. When you sallallahu alayhi wa sallam finished, I was greatly astonished at the boldness I had shown before the Noble Prophet sallallahu alayhi wa sallam, but in any case, Allah and His Messenger know best. However, by Allah! Only a little time had passed when these two verses were revealed: {وَلَا تُصَلِّ عَلٰی أَحَدٍ مِنْہُمْ مَاتَ أَبَدًا وَلَا تَقُمْ عَلٰی قَبْرِہِ إِنَّہُمْ کَفَرُوْا بِاللّٰہِ وَرَسُولِہِ وَمَاتُوْا وَہُمْ فَاسِقُونَ} … And never pray over any of them who dies, nor stand at his grave. Indeed, they disbelieved in Allah and His Messenger and died while they were defiantly disobedient. After this, the Messenger of Allah sallallahu alayhi wa sallam did not perform the funeral prayer for any hypocrite, nor did he stand at his grave, until you sallallahu alayhi wa sallam passed away. (Sahih Bukhari: 1366, 4671, and the wording is from Ahmad)