An Amazing story from al-Hassan al-Basri (rahimahullah)
Shytan has power over the believers due to their sins
A hadith states, “Allah is with the judge as long as he does not commit any injustice. If he commits any injustice, Allah is free from him and keeps Shytan with him.” 
Abu al-Faraj ibn al-Jauzi  has related a unique story from al-Hassan al-Basri (rahimahullah). The story, depending on how authentic it is, shows the ability of a human in overpowering Shytan if he is sincere to Allah in his religion and it shows how Shytan can take advantage of the human when he strays.
Al-Hasan al-Basri narrated that there was a tree that was worshipped instead of Allah. One man decided to chop down that tree. He was going to chop down the tree out of anger for the sake of Allah. On the way to the tree he met Iblees who was in the form of a man. Iblees asked him, “What do you plan on doing?” The man answered, “I am going to chop down that tree that is worshipped instead of Allah.” Shytan said, “If you do not worship it, why should it harm you if others do so?” The man replied, “I will chop it down.” Shytan then told him, “Would you like something better than that” Do not cut it and you will get two dinars every morning under your pillow.” “From where will I get that?” the man asked. “I will give it to you,” said Iblees. The man returned and the next morning he found two dinars under his pillow. The following morning he again found two dinars under his pillow. On the following morning he did not find anything. He got upset and went to chop down the tree. Shytan again appeared to him in the shape of the same man. Shytan asked him, “What do you want to do?” The man answered, “I plan on cutting down that tree that is worshipped instead of Allah!” Iblees said, “You have lied. There is no way you will be able to do it,” The man left to chop it down. The earth swallowed him and him until it almost killed him. Iblees asked, “Do you know who I . I am Shytan. I met you for the first time when you were angry for the sake of Allah and I had no power over you. I deceived you by two dinars and you stopped what you had intended to do [for the sake of Allah]. Now you have come because you are angry about the two dinars, and I have gotten mastery over you.”
 This was recorded by al-Haakim and al-Baihaqi with a hasan chain. See al- Albanee Sahih al-Jaami, vol. 2, p.130
 Ibn al-Jawzi, Talbees Iblees, p. 43 [The author, al-Ashqar alluded to the fact that the authenticity of this story needs to be ascertained. Most likely, it is from the Israaeeliyaat or stories of the Jews and Christians.]
Source : The world of Jinn and Devils – Umar S. Ashqar