When Abu Talib was on his deathbed, the Messenger of Allah ﷺ came to him and found Abu Jahl and Abdullah bin Abu Umaya bin Mughira with him.The Messenger of Allah ﷺ said, "Uncle, say 'There is no god but Allah,' a word by which I may testify on your behalf before Allah."Abu Jahl and Abdullah bin Abu Umaya said, "Abu Talib, will you turn away from the religion of Abdul-Muttalib?"The Messenger of Allah ﷺ kept presenting it to him and repeating those words, until the last thing Abu Talib said to them was that he was upon the religion of Abdul-Muttalib, and he refused to say "There is no god but Allah."The Messenger of Allah ﷺ then said, "By Allah, I will surely seek forgiveness for you so long as I am not forbidden from doing so."So Allah revealed, "It is not for the Prophet and those who believe to seek forgiveness for the polytheists, even if they were relatives, after it has become clear to them that they are companions of the Hellfire" [Tawbah 9:113].And Allah the Exalted revealed concerning Abu Talib, saying to the Messenger of Allah ﷺ, "Indeed, you do not guide whom you love, but Allah guides whom He wills, and He is most knowing of the rightly guided" [Qasas 28:56].
و حدثني حرملة بن يحيى التجيبي أخبرنا عبد الله بن وهب قال أخبرني يونس عن ابن شهاب قال أخبرني
لما حضرت أبا طالب الوفاة جاءه رسول الله ﷺ فوجد عنده أبا جهل وعبد الله بن أبي أمية بن المغيرة فقال رسول الله ﷺ يا عم قل لا إله إلا الله كلمة أشهد لك بها عند الله فقال أبو جهل وعبد الله بن أبي أمية يا أبا طالب أترغب عن ملة عبد المطلب فلم يزل رسول الله ﷺ يعرضها عليه ويعيد له تلك المقالة حتى قال أبو طالب آخر ما كلمهم هو على ملة عبد المطلب وأبى أن يقول لا إله إلا الله فقال رسول الله ﷺ أما والله لأستغفرن لك ما لم أنه عنك فأنزل الله عز وجل {ما كان للنبي والذين آمنوا أن يستغفروا للمشركين ولو كانوا أولي قربى من بعد ما تبين لهم أنهم أصحاب الجحيم} وأنزل الله تعالى في أبي طالب فقال لرسول الله ﷺ {إنك لا تهدي من أحببت ولكن الله يهدي من يشاء وهو أعلم بالمهتدين}