“They followed what the Shayāṭīn (devils) gave out (falsely of the magic) in the lifetime of Sulaymān (Solomon). Sulaymān did not disbelieve, but the Shayāṭīn (devils) disbelieved, teaching men magic and such things that came down at Babylon to the two angels, Hāroot and Māroot, but neither of these two (angels) taught anyone (such things) till they had said, ‘We are only for trial, so disbelieve not (by learning this magic from us).’ And from these (angels) people learn that by which they cause separation between man and his wife, but they could not thus harm anyone except by Allāh’s Leave. And they learn that which harms them and profits them not. And indeed they knew that the buyers of it (magic) would have no share in the Hereafter. And how bad indeed was that for which they sold their ownselves, if they but knew.” • [al-Qur'ān 2:102]

Ibn ‘Abbās رضي الله عنهما said: “When someone came to the angels to learn magic, they would discourage him and say to him, ‘We are only a test, so do not fall into disbelief.’ They had knowledge of what is good and evil and what constitutes belief or disbelief, and they thus knew that magic is a form of disbelief. When the person who came to learn magic still insisted on learning it, they commanded him to go to such and such place, where if he went, Shayṭān would meet him and teach him magic. When this man would learn magic, the light (of faith) would depart him, and he would see it shining (and flying away) in the sky. He would then proclaim, ‘O my sorrow! Woe unto me! What should I do?'”

al-Ḥasan al-Baṣrī رحمه الله said: “The angels were sent with magic, so that the people whom Allāh willed would be tried and tested. Allāh made them promise that they (the angels) would not teach magic to anyone until first proclaiming, 'We are a test for you, do not fall into disbelief.'”

It was recorded by Ibn Abī Ḥātim. Also, Qatādah رحمهم الله said: “Allāh took their (the angels) covenant to not teach anyone magic until they said, 'We are a test. Therefore, do not fall in disbelief.'”

Also, as-Suddī رحمه الله said: “When a man would come to the two angels they would advise him, 'Do not fall into disbelief. We are a test.’ When the man would ignore their advice, they would say, 'Go to that pile of ashes and urinate on it.’ When he would urinate on the ashes, a light, meaning the light of faith, would depart from him and would shine until it entered heaven. Then something black that appeared to be smoke would descend and enter his ears and the rest of his body, and this is Allāh’s anger. When he told the angels what happened, they would teach him magic.”

Ibn Jurayj (one of the Salaf) رحمه الله commented on this Āyah (2:102) and said: “No one dares practice magic except a DISBELIEVER.”

● [تفسير ابن كثير]