Allah, the Exalted, has said:
٣٦٢ - باب التغليظ في تحريم السحر
Allah, the Exalted, has said:
And they followed [instead] what the devils had recited during the reign of Solomon. It was not Solomon who disbelieved, but the devils disbelieved, teaching people magic and that which was revealed to the two angels at Babylon, Hārūt and Mārūt. But they [i.e., the two angels] do not teach anyone unless they say, "We are a trial, so do not disbelieve [by practicing magic]."1 And [yet] they learn from them that by which they cause separation between a man and his wife. But they do not harm anyone through it except by permission of Allāh. And they [i.e., people] learn what harms them and does not benefit them. But they [i.e., the Children of Israel] certainly knew that whoever purchased it [i.e., magic] would not have in the Hereafter any share. And wretched is that for which they sold themselves, if they only knew.
On the authority of Abū Hurayrah (may Allah be pleased with him), from the Prophet (ﷺ), who said: "Avoid the seven destructive sins." They said: "O Messenger of Allah, what are they?" He said: "Associating partners with Allah, sorcery, killing the soul which Allah has made inviolable except by right, consuming usury, devouring the property of the orphan, fleeing on the day of battle, and slandering chaste, believing, unwary women." Agreed upon.