Shaykh Al-Islām ibn Taymiyyyah رحمه الله said:
From what clarifies love for Allāh and love for other than Allāh is that Abu Bakr loved the Prophet ﷺ sincerely for Allāh, while Abu Tālib, his uncle, loved him and aided him for his desires, not for Allāh.
So Allāh accepted the deeds of Abu Bakr and revealed regarding him:
﴾وَسَيُجَنَّبُهَا ٱلْأَتْقَى﴿
“And Al-Muttaqun (the pious and righteous) will be far removed from it (Hell).”
﴾ٱلَّذِى يُؤْتِى مَالَهُۥ يَتَزَكَّىٰ﴿
“He who spends his wealth for increase in self-purification,”
﴾وَمَا لِأَحَدٍ عِندَهُۥ مِن نِّعْمَةٍ تُجْزَىٰٓ﴿
“And have in his mind no favour from anyone for which a reward is expected in return,”
﴾إِلَّا ٱبْتِغَآءَ وَجْهِ رَبِّهِ ٱلْأَعْلَىٰ﴿
“Except only the desire to seek the Countenance of his Lord, the Most High;”
﴾وَلَسَوْفَ يَرْضَىٰ﴿
“He surely will be pleased (when he will enter Paradise).”¹
As for Abu Tālib, Allah didn’t accept his deeds, rather he put him in Hell because he was a Mushrik, acting for other than Allah.
Majmū’ Al-Fatāwa (11/525-526)
Translated by Abū Muḥsinah Mubaarak
1. Al-Layl 17-21