Allah, the Mighty and Majestic, says: "And they followed what the devils recited during the reign of Sulayman (peace be upon him). It was not Sulayman (peace be upon him) who disbelieved, but the devils disbelieved, teaching people sorcery." [Surah al-Baqarah: 102]
Up to His saying: "But they could not harm anyone through it except by the permission of Allah, and they learned what harmed them and did not benefit them." (to the end of the verse) [Surah al-Baqarah: 102]
Hadith Referenceالسنن الكبرى للبيهقي / كتاب القسامة / Q16494