40وَيَوْمَ يَحْشُرُهُمْ جَمِيعًا ثُمَّ يَقُولُ لِلْمَلَـٰٓئِكَةِ أَهَـٰٓؤُلَآءِ إِيَّاكُمْ كَانُوا۟ يَعْبُدُونَ
41قَالُوا۟ سُبْحَـٰنَكَ أَنتَ وَلِيُّنَا مِن دُونِهِم ۖ بَلْ كَانُوا۟ يَعْبُدُونَ ٱلْجِنَّ ۖ أَكْثَرُهُم بِهِم مُّؤْمِنُونَ
42فَٱلْيَوْمَ لَا يَمْلِكُ بَعْضُكُمْ لِبَعْضٍ نَّفْعًا وَلَا ضَرًّا وَنَقُولُ لِلَّذِينَ ظَلَمُوا۟ ذُوقُوا۟ عَذَابَ ٱلنَّارِ ٱلَّتِى كُنتُم بِهَا تُكَذِّبُونَ
[40-42] And the Day when He will gather all mankind together, He will ask the angels, "Did they really worship you?"61 They will reply, "Glory be to Thee: our connection is with Thee, not with them.62 They, in fact, worshiped the jinns, not us. It was in them that most of them believed."63 (At that time We shall say:) "Today you can neither help nor harm one another." And to the wrongdoers We shall say, Now taste the torment of Hell which you used to deny."
61Since the earliest times the polytheists in every age have been looking upon the angels as gods and goddesses and carving their idols and worshiping them. One has been regarded as the god of rain, another of lightning and another of wind; one is the goddess of wealth, another of knowledge and another of life and death. About this Allah says that on the Day of Resurrection the angels will be asked: ¦Were you being worshiped as deities by these people?" This question is not meant merely to find out the truth, but to ask, "Did you approve of their worship? Did you tell the people that you were their deities, so they should worship you? Or, did you wish that the people should do obeisance to you?" This question will not only be asked of the angels but of all those beings who have been worshiped as gods in the world. In Surah AI-Furqan it has been said: "On that Day (Allah) will gather all these people together as well as their deities, whom they worship beside Allah. Then he will ask them, 'Did you mislead these servants of Mine, or did they themselves go astray?' " (V. 17).
62That is, They will answer: You are Pure and Exalted far above that another should be made a partner in Godhead with you. We have no connection with these people: we are not responsible for them, nor for what they did. We are Your servants only.
63In this sentence, jinn implies the satans among the jinns. The answer means: "Apparently these people worshiped us, by mentioning our names and by making our images according to their imaginations. But, in fact, they did not worship us but worshiped the satans, for the satans only had shown them the way that they should regard others than Allah as fulfillers of their needs, and should make offerings before them. "
This verse clearly brings out the error of the view of those people who take the word "jinn" to mean the dwellers of the mountains and deserts and rural areas. Can a sensible person imagine, on the basis of this verse, that the people used to worship the dwellers of the mountains and the deserts and the villages and believed in them?
This verse also throws light on another meaning of 'ibadat. It shows that 'ibadat is not mere worship and service, but it also implies carrying out somebody's orders and obeying him without question. Even if one curses another (as one curses Satan) but at the time follows his way, one would be performing his 'ibadat. For other examples, see An-Nisa': 117-119; Al-Ma'idah: 60; At-Taubah: 31; Maryam: 42; AI-Qasas:63. "