Ruling on going to someone who undoes spells
Question

                If a person goes to the imam of a mosque who claims to undo witchcraft and does what he says, thinking that this will undo the witchcraft without knowing that this is haraam, has he committed a sin? What is the ruling on that?.
Praise be to Allah.If a person undoes spells 
    or witchcraft, one of two scenarios must apply: 
1-
He uses shar’i ruqyahs and 
    ta’awwudhaat (prayers seeking refuge with Allaah) that were narrated from 
    the Prophet  (peace and blessings of Allaah be upon him), and 
    permissible remedies. There is nothing wrong with this, rather it is 
    mustahabb. 
2-
He treats the spell by 
    doing witchcraft which means drawing close to the jinn by offering 
    sacrifices or doing other acts of worship. This is not permissible, because 
    it is the handiwork of the shaytaan and is in fact major shirk, so we must 
    beware of it. It is also not permissible to deal with it by asking 
    sorcerers, fortune-tellers and charlatans or doing what they say. The 
    Messenger  (peace and blessings of Allaah be upon him) has warned 
    against going to them, asking them questions and believing them. He  
    (peace and blessings of Allaah be upon him) said: “Whoever goes to a 
    fortune-teller and asks him about something, his prayer will not be accepted 
    for forty days.” Narrated by Muslim (4137). 
And the Messenger of Allaah 
     (peace and blessings of Allaah be upon him) said: “Whoever goes to a 
    soothsayer or fortune-teller and believes what he says has disbelieved in 
    that which was revealed to Muhammad  (peace and blessings of Allaah be 
    upon him).” Narrated by Ahmad in al-Musnad (9171) and classed as 
    saheeh by al-Albaani in Saheeh al-Jaami’, hadeeth no. 5939. 
So it is not permissible to 
    go to practitioners of witchcraft or ask them anything or believe them. 
Abu Dawood narrated in his
    Sunan (3370) that Jaabir ibn ‘Abd-Allaah (may Allaah be pleased with 
    him) said: The Messenger of Allaah  (peace and blessings of Allaah be 
    upon him) was asked about al-nushrah and he said: “It is the handiwork of 
    the shaytaan.” Classed as saheeh by al-Albaani. 
Ibn al-Qayyim said in 
    I’laam al-Muwaqqi’een (4/399): Nushrah means undoing witchcraft. It is 
    of two types: undoing witchcraft by means of witchcraft, which is the 
    handiwork of the shaytaan, because witchcraft is the handiwork of the 
    shaytaan, and the one who engages in nushrah and the one for whom it is done 
    draw close to him by means of what he likes, thus undoing the spell. The 
    second type is undoing witchcraft by means of ruqyah, ta’awwudhaat, du’aa’s 
    and permissible kinds of medicine. This is permissible, and is in fact 
    mustahabb. End quote. 
Thus you will know that if 
    this imam is of the type who undoes witchcraft by means of haraam methods, 
    then going to him is a sin, and may constitute kufr. What the one who has 
    gone to him must do is repent from that, and Allaah accepts the repentance 
    of the one who repents. If he did this out of ignorance then we hope that 
    there is no sin on him, but he must give that up and resolve not to do it 
    again in the future. 
If he is one of the type 
    who treat those who are bewitched by means of the Holy Qur’aan and du’aa’s 
    narrated from the Prophet  (peace and blessings of Allaah be upon him), 
    then there is nothing wrong with going to him, and that is not a sin. 
And Allaah knows best.