Abdullah bin Abdullah bin Ubayy reported,

He came to the Prophet ﷺ when his father died and said, "Give me your shirt so I may shroud him in it, pray over him, and seek forgiveness for him." So he gave him his shirt and said, "When you have finished, inform me."When he intended to pray over him, Umar pulled him back and said, "Has Allah not forbidden you to pray over the hypocrites?"He replied, "I have been given a choice between two options, 'Whether you seek forgiveness for them or do not seek forgiveness for them' [Tawbah 9:80]." So he prayed over him.Then Allah revealed, "And never pray over any of them who has died, nor stand at his grave" [Tawbah 9:84]. So he ceased praying over them.

Tirmidhi 3098

Sahih

حدثنا محمد بن بشار حدثنا يحيى بن سعيد حدثنا عبيد الله أخبرنا نافع عن ابن عمر قال جاء

عبد الله بن عبد الله بن أبي

إلى النبي ﷺ حين مات أبوه فقال أعطني قميصك أكفنه فيه وصل عليه واستغفر له فأعطاه قميصه وقال إذا فرغتم فآذنوني فلما أراد أن يصلي جذبه عمر وقال أليس قد نهى الله أن تصلي على المنافقين فقال أنا بين خيرتين {استغفر لهم أو لا تستغفر لهم} فصلى عليه فأنزل الله {ولا تصل على أحد منهم مات أبدا ولا تقم على قبره} فترك الصلاة عليهم

الترمذي 3098صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami Tirmidhi
Book
Tafsir of the Quran
Chapter
From Surah Tawbah
Numbering
Darussalam 3098
Tirmidhi 3098