Allah the Exalted says:
“On the Day He gathers them all together, He will then say to the angels, ‘Was it you that these people worshipped?’ (40) They will say, ‘Glory be to You! You are our Protector, not they. Rather, they worshipped the jinn; most of them believed in them.’ (41) On that Day, none of you will have power to benefit or harm one another. And We shall say to those who did wrong, ‘Taste the punishment of the Fire which you used to deny.’ (42) When Our clear verses are recited to them, they say, ‘This is no more than a man who seeks to turn you away from what your fathers used to worship.’ And they say, ‘This is nothing but a fabricated lie.’ And those who disbelieve say of the truth when it comes to them, ‘This is nothing but manifest magic.’ (43) We had not given them any books for them to study, nor had We sent them any warner before you.” (44)
Regarding His words, “On the Day He gathers them”: Ya‘qub and Hafs recited it as yahshuruhum (“He gathers them”), while the others recited it with the first-person plural form, nahshuruhum (“We gather them”). “All together” means these disbelievers. “He will then say to the angels, ‘Was it you that these people worshipped?’” in the life of this world.
Qatadah said: This is a question intended to elicit confirmation, like His words to Jesus: “Did you say to the people, ‘Take me and my mother as two gods besides Allah’?” (Maryam 116). The angels will then disavow them.
“They will say, ‘Glory be to You!’” that is, declaring You far above any imperfection. “You are our Protector, not they”: meaning, we take You as our Protector, and not them. “Rather, they worshipped the jinn,” meaning the devils. If it is asked: They worshipped the angels, so how can He say, “They worshipped the jinn”? The answer is that He means the devils: 89/b they had embellished for them the worship of the angels. Thus, in worshipping the angels, they were obeying the devils. Therefore, “they worshipped” means that they obeyed the jinn. “Most of them believed in them,” meaning that they believed the devils.
Then Allah says: “On that Day, none of you will have power to benefit one another,” through intercession, “or harm,” through punishment. That is, they are powerless: they possess neither benefit nor harm. “And We shall say to those who did wrong, ‘Taste the punishment of the Fire which you used to deny.’”
“When Our clear verses are recited to them, they say, ‘This is no more than a man’”—meaning Muhammad, peace and blessings be upon him—“who seeks to turn you away from what your fathers used to worship.” “And they say, ‘This is nothing but a fabricated lie,’” meaning the Quran. “And those who disbelieve say of the truth when it comes to them, ‘This is nothing but manifest magic,’” that is, evident magic.
“We had not given them”—meaning these polytheists—“any books for them to study,” that is, to read; “nor had We sent them any warner before you,” meaning that no prophet had come to the Arabs before you, nor had any book been sent down to them.