Question: If it is said that they used to worship idols, how did that become the worship of the jinn?
Answer: Because they worshipped the idols only out of obedience to the jinn. The example of such people is like that of a man who set out on a journey with other people, then lost his way; the devils and jinn bewildered him and made him wander in the land, while his companions remained on the straight path and kept calling him to them, onto the straight path.
كَالَّذِي اسْتَهْوَتْهُ الشَّيَاطِينُ فِي الْأَرْضِ حَيْرَانَ لَهُ أَصْحَابٌ
“Like the one whom the devils have led astray in the land, bewildered, while he has companions.”
This is the person who does not accept the guidance of Allah the Exalted; rather, he obeyed the devil and committed acts of disobedience in the land, turned away from the truth and went astray. For guidance is only the guidance of Allah the Exalted, and what the jinn (devils) call to is misguidance.
The third evidence is the saying of Allah the Exalted:
أَلَمْ أَعْهَدْ إِلَيْكُمْ يَا بَنِي آدَمَ أَن لَّا تَعْبُدُوا الشَّيْطَانَ ۖ إِنَّهُ لَكُمْ عَدُوٌّ مُّبِينٌ ﴿٦٠﴾
“Did I not instruct you, O children of Adam, that you should not worship the devil? Indeed, he is a clear enemy to you.”
This is a rebuke from Allah the Exalted to those disbelievers among the children of Adam who followed the devil, although he is their clear enemy, and who disobeyed Allah the Exalted, although Allah created them and it is He who provides for them.