Narrated Ibn 'Abbas:
I heard 'Umar bin Al-Khattab saying: 'When 'Abdullah bin Ubayy died, the Messenger of Allah (ﷺ) was called to perform the funeral prayer over him. The Messenger of Allah (ﷺ) came to him, and when he stood over him, about to perform the prayer, he turned until he was standing at his chest. I said: O Messenger of Allah! (You pray) for Allah's enemy 'Abdullah bin Ubayy, who on this day said this and that - mentioning different days. He said: The Messenger of Allah (ﷺ) was smiling until I had said too much to him and he said: 'Leave me O 'Umar! Indeed I have been given the choice, so I chose. I was told: Whether you ask forgiveness for them, or do not ask for forgiveness for them. Even though you ask for their forgiveness seventy times, Allah will not forgive them (9:80). If I knew that were I to ask more than seventy times that he would be forgiven, then I would do so. He said: Then he performed the Salat for him and walked with him (his funeral procession) and he stood at his grave until it was finished. I was amazed at myself and my daring to talk like that to the Messenger of Allah (ﷺ), while Allah and His Messenger (ﷺ) know better. But by Allah! It was not long until these two Ayat were revealed: 'And never pray for any of them who dies nor stand at his grave... (9:84) until the end of the Ayah. He said: So afterwards the Messenger of Allah (ﷺ) did not perform the Salat for a hypocrite, nor would he stand at his grave until Allah took him.