Praise be to Allaah.
Allaah says in His Book (interpretation of the meaning):
“It is not (proper) for the Prophet and those who believe to ask Allaah’s forgiveness for the Mushrikoon, even though they be of kin, after it has become clear to them that they are the dwellers of the Fire (because they died in a state of disbelief)” [al-Tawbah 9:113]
Al-Qurtubi said in al-Ahkaam (8/173): “This aayah means that one should cut off ties of close friendship with the kuffaar, whether they are alive or dead. Allaah did not allow the believers to pray for forgiveness for the mushrikeen. Seeking forgiveness for a mushrik is something that is not permitted.”
Muslim narrated in his Saheeh (916) from Abu Hurayrah (may Allaah be pleased with him) that the Messenger of Allaah (peace and blessings of Allaah be upon him) said: “I asked my Lord for permission to pray for forgiveness for my mother, and He did not permit me. I asked Him for permission to visit her grave, and He granted me permission.”
This hadeeth makes it clear that Allaah did not permit His Prophet, who is the noblest of His creation, to seek forgiveness for his mother after she had died. This is what Allaah forbids in the aayah quoted above, and the hadeeth states this clearly. Al-Shawkaani said in Fath al-Qadeer (2/410): This aayah implies that there are no ties of close friendship with the kuffaar, and that it is haraam to pray for forgiveness for them, or to make du’aa’ for kaafirs in ways that are not permitted.
If someone were to say that Ibraaheem prayed for his kaafir father, as he said,
“Peace be on you! I will ask forgiveness of my Lord for you. Verily, He is unto me Ever Most Gracious” [Maryam 19:47 – interpretation of the meaning],
the response to that is what Allaah said in the aayah (interpretation of the meaning):
“And Ibraaheem’s (Abraham) invoking (of Allaah) for his father’s forgiveness was only because of a promise he [Ibraaheem] had made to him (his father). But when it became clear to him that he (his father) is an enemy of Allaah, he dissociated himself from him. Verily, Ibraaheem was Awwah (one who invokes Allaah with humility, glorifies Him and remembers Him much) and was forbearing” [al-Tawbah 9:114]
Ibn ‘Abbaas (may Allaah be pleased with him) said: When he died, it became clear to him that he was an enemy of Allaah. (Tafseer Ibn Katheer).
And Allaah knows best.