Judges 9:23 Then God sent an evil spirit between Abimelech and the men of Shechem; and the men of Shechem dealt treacherously with Abimelech.
After Gideon died much civil strife arose among the people. Abimelech had 70 sons of Gideon killed and made himself king for a short while. Rebellion, pride, and arrogance caused a period of rebellion and unrest in and around Shechem. The sin of Abimelech caused the troubles. God Himself had to put a stop to the anarchy by sending an evil spirit to come between him and the city. Abimelech receives a spirit of trouble that leads to his downfall. (A woman dropped a millstone on his head.)
Most of the judges in this book receive the Spirit of the Lord to empower and help them, sometimes even reluctantly. But Abimelech was not chosen by God; he took it upon himself to exert power for himself. His own presumption and pride brought the spirit of trouble. God used the devil to stop the strife, just like He sent an evil spirit to vex King Saul, who tried to kill David.
Why does God use the devil? Since God Himself cannot do evil or stir up trouble He allows Sin to have its way and lead to its natural consequences of strife and trouble. The source and cause of the evil spirit is not God but it is in the sinner. We mean evil, but means it for good. Let the Lord have His way and His will be done.