The hadeeth was narrated by al-Bukhaari (1344) and Muslim (2296) from Uqbah ibn Aamir, and says that the Prophet (blessings and peace of Allah be upon him) came out one day and prayed for the people of Uhud as he used to pray for the dead. Then he went to the minbar and said: I will be there ahead of you, and I will be your witness. By Allaah, I can see my Cistern now. I am given the keys to the treasures of the earth, or the keys to the earth. By Allaah, I do not fear that you will associate others with Allaah after I am gone, but I fear that you will compete with one another for them (the treasures of the earth).
What is meant by his praying for them (the people of Uhud) as he used to pray for the dead is his offering supplication for them with the duaa' that is recited in the funeral prayer. This was seven years after they were martyred (may Allah be pleased with them).
There is nothing in the hadeeth to say that shirk (association of others with Allah) will not happen in this ummah; rather it may be understood that he did not fear it for the entire ummah, based on the fact that it has occurred among some of them, as is indicated in other texts in which he (blessings and peace of Allah be upon him) stated that some of his ummah would fall into shirk.
An-Nawawi (may Allah have mercy on him) said in his commentary on Muslim (Sharh Muslim): In this hadeeth we see the miracles of the Messenger of Allah (blessings and peace of Allah be upon him), because what it means is a foretelling that his ummah would be given the treasures of the earth, which did indeed come to pass; and that they would not all apostatise because Allah, may He be exalted, protected them from that; and that they would compete with one another for worldly gain. And all of that came to pass. End quote.
Al-Haafiz Ibn Hajar al-Asqallaani (may Allah have mercy on him) said: The words I do not fear that you will associate others with Allah mean: (I do not fear that you will do that) en masse, because that happened with some of them - may Allah protect us. This hadeeth is one of the miracles of the Prophet (blessings and peace of Allah be upon him), hence the author narrated it under the heading of the signs of Prophethood.
End quote from Fath al-Baari, 3/211
The saheeh Sunnah indicates that among this ummah will be some who associate others with Allah, may He be exalted.
al-Bukhaari (7116) and Muslim (2906) narrated from Abu Hurayrah (may Allah be pleased with him) that the Messenger of Allah (blessings and peace of Allah be upon him) said: The Hour will not begin until the backsides of the women of Daws wobble (as they go) around Dhu'l-Khalasah.
Dhu'l-Khalasah was a false god of Daws that they used to worship during the Jaahiliyyah.
Muslim (2907) narrated that Aa'ishah said: I heard the Messenger of Allah (blessings and peace of Allah be upon him) say: Night and day will not cease until al-Laat and al-Uzza are worshipped. I said: O Messenger of Allaah, when Allaah revealed the words He it is Who has sent His Messenger (Muhammad صلى الله عليه وسلم) with guidance and the religion of truth (Islamic Monotheism) to make it victorious over all (other) religions even though the Mushrikoon (polytheists, pagans, idolaters, and disbelievers in the Oneness of Allaah and in His Messenger Muhammad صلى الله عليه وسلم) hate (it) [al-Saff 61:33], I thought that that had been fulfilled and would never be undone. He said: As much of that as Allaah wills will happen, then Allaah will send a pleasant wind which will cause everyone in whose heart is faith the size of a grain of mustard seed to die, then there will be left those in whom there is no good, and they will revert to the religion of their forefathers.
Thus it becomes clear that some of the Muslims will fall into shirk and apostasy, without that affecting the entire ummah, for it is protected against uniting in misguidance.
How can the Muslim doubt that calling upon the dead, beseeching them at times of calamity and asking them to relieve distress are acts of shirk? In fact this is the essence of what the earlier mushrikeen used to do, seeking to draw close to Allah or seeking intercession with Him, as Allah says (interpretation of the meaning):
And those who take Auliya (protectors and helpers) besides Him (say): "We worship them only that they may bring us near to Allah." Verily, Allah will judge between them concerning that wherein they differ. Truly, Allah guides not him who is a liar, and a disbeliever.
And they worship besides Allah things that hurt them not, nor profit them, and they say: These are our intercessors with Allah.' Say: Do you inform Allah of that which He knows not in the heavens and on the earth?' Glorified and Exalted be He above all that which they associate as partners with Him!
Mankind were but one community (i.e. on one religion - Islamic Monotheism), then they differed (later), and had not it been for a Word that went forth before from your Lord, it would have been settled between them regarding what they differed
[Yoonus 10:18, 19]
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said: The one who makes the angels and Prophets mediators on whom he calls and in whom he puts his trust, and asks them to bring benefits and ward off harm, such as asking them for forgiveness of sins, guidance of hearts, relief of distress and meeting his needs, is a kaafir according to the consensus of the Muslims.
End quote from Majmoo al-Fataawa, 1/124
This consensus was narrated by more than one of the scholars who affirmed it, see: al-Furoo by Ibn Muflih, 6/165; al-Insaaf, 10/327; Kashshaaf al-Qinaa, 6/169; Mataalib Ooli'n-Nuha, 6/279. These are the essential reference books of Hanbali fiqh.
In Kashshaaf al-Qinaa it says, after mentioning this consensus under the heading of the ruling on the apostate: Because this is like the action of the idol worshippers who say, We only worship them so that they might bring us closer to Allah.'
More than one of the scholars has clearly stated that what some of the ignorant Muslims do of focusing their devotion on graves is the essence of what the earlier mushrikeen used to do.
Ar-Raazi (may Allah have mercy on him) said in his commentary on the verse from Soorat Yoonus quoted above, explaining the explanations that the mushrikeen gave for their worship of idols:
Fourthly: they made these idols and statues in the image of their Prophets and great men, and claimed that if they devoted themselves to worshipping these statues, those great men would be intercessors for them with Allah, may He be exalted. The equivalent to that in our own times is the devotion of many people to venerating the graves of great men, in the belief that if they venerate their graves, they will intercede for them with Allah.
End quote from Mafaateeh al-Ghayb, 17/49
For more information, see the answer to question no. 42919.
And Allah knows best.
Reproduced from Islam QA