Sahih al-Bukhari, Hadith 1366

Narrated `Umar bin Al-Khattab: When `Abdullah bin Ubai bin Salul died, Allah's Messenger (p.b.u.h) was called upon to offer his funeral prayer. When Allah's Messenger stood up to offer the prayer, I got up quickly and said, "O Allah's Apostle! Are you going to pray for Ibn Ubai and he said so and so on such and such occasions?" And started mentioning all that he had said. Allah's Messenger smiled and said, "O `Umar! Go away from me." When I talked too much he said, "I have been given the choice and so I have chosen (to offer the prayer). Had I known that he would be forgiven by asking for Allah's forgiveness for more than seventy times, surely I would have done so." (`Umar added): Allah's Messenger offered his funeral prayer and returned and after a short while the two verses of Surat Bara' were revealed: i.e. "And never (O Muhammad) pray for any of them who dies... (to the end of the verse) rebellion (9.84)" -- (`Umar added), "Later I astonished at my daring before Allah's Messenger on that day. And Allah and His Apostle know better."

حَدَّثَنَا يَحْيَى بْنُ بُكَيْرٍ، حَدَّثَنِي اللَّيْثُ، عَنْ عُقَيْلٍ، عَنِ ابْنِ شِهَابٍ، عَنْ عُبَيْدِ اللَّهِ بْنِ عَبْدِ اللَّهِ، عَنِ ابْنِ عَبَّاسٍ، عَنْ عُمَرَ بْنِ الْخَطَّابِ ـ رضى الله عنهم ـ أَنَّهُ قَالَ لَمَّا مَاتَ عَبْدُ اللَّهِ بْنُ أُبَىٍّ ابْنُ سَلُولَ دُعِيَ لَهُ رَسُولُ اللَّهِ صلى الله عليه وسلم لِيُصَلِّيَ عَلَيْهِ، فَلَمَّا قَامَ رَسُولُ اللَّهِ صلى الله عليه وسلم وَثَبْتُ إِلَيْهِ فَقُلْتُ يَا رَسُولَ اللَّهِ، أَتُصَلِّي عَلَى ابْنِ أُبَىٍّ وَقَدْ قَالَ يَوْمَ كَذَا وَكَذَا كَذَا وَكَذَا ـ أُعَدِّدُ عَلَيْهِ قَوْلَهُ ـ فَتَبَسَّمَ رَسُولُ اللَّهِ صلى الله عليه وسلم وَقَالَ ‏"‏ أَخِّرْ عَنِّي يَا عُمَرُ ‏"‏‏.‏ فَلَمَّا أَكْثَرْتُ عَلَيْهِ قَالَ ‏"‏ إِنِّي خُيِّرْتُ فَاخْتَرْتُ، لَوْ أَعْلَمُ أَنِّي إِنْ زِدْتُ عَلَى السَّبْعِينَ فَغُفِرَ لَهُ لَزِدْتُ عَلَيْهَا ‏"‏‏.‏ قَالَ فَصَلَّى عَلَيْهِ رَسُولُ اللَّهِ صلى الله عليه وسلم ثُمَّ انْصَرَفَ، فَلَمْ يَمْكُثْ إِلاَّ يَسِيرًا حَتَّى نَزَلَتِ الآيَتَانِ مِنْ ‏{‏بَرَاءَةٌ‏}‏ ‏{‏وَلاَ تُصَلِّ عَلَى أَحَدٍ مِنْهُمْ مَاتَ أَبَدًا‏}‏ إِلَى ‏{‏وَهُمْ فَاسِقُونَ‏}‏ قَالَ فَعَجِبْتُ بَعْدُ مِنْ جُرْأَتِي عَلَى رَسُولِ اللَّهِ صلى الله عليه وسلم يَوْمَئِذٍ، وَاللَّهُ وَرَسُولُهُ أَعْلَمُ‏.‏

sunnah.com