"Then the children of Israel did evil in the sight of the LORD, and served the Baals and the Ashtoreths, the gods of Syria, the gods of Sidon, the gods of Moab, the gods of the people of Ammon, and the gods of the Philistines; and they forsook the LORD and did not serve Him. So the anger of the LORD was hot against Israel; and He sold them into the hands of the Philistines and into the hands of the people of Ammon. From that year they harassed and oppressed the children of Israel for eighteen years--all the children of Israel who were on the other side of the Jordan in the land of the Amorites, in Gilead. Morever the people of Ammon crossed over the Jordan to fight against Judah also, against Benjamin, and against the house of Ephraim, so that Israel was severely distressed" (Jud. 10:6-9).
This is the same basic theme over and over again (sin leads to suffering). When will they learn (and when will we learn)?! This self-inflicted oppression was avoidable. Obey God and be blessed! Don't stir up His anger against yourself!
"And the children of Israel cried out to the LORD, saying, 'We have sinned against You, because we have both forsaken our God and served the Baals!' So the LORD said to the children of Israel, 'Did I not deliver you from the Egyptians and from the Amorites and from the people of Ammon and from the Philistines? Also the Sidonians and Amalekites and Maonites oppressed you; and you cried out to Me, and I have delivered you from their hand. Yet you have forsaken Me and served other gods. Therefore I will deliver you no more. Go and cry out to the gods which you have chosen; let them deliver you in your time of distress'" (10:10-14).
It would have been bad enough to forsake the true and living God and become atheists. However, they had left the LORD and embraced seven dead idols, attributing the blessings God provided to the generosity of worthless idols! There was no good reason for them to do this. The LORD had delivered them time after time from bad situations. The false gods had done nothing beneficial for them, and they seemed to realize this when they got in a jam since they eventually would always plead with the true and living God! He is so upset with them, however, that He tells them to cry out to the gods they had been serving. Let them provide deliverance!
"And the children of Israel said to the LORD, 'We have sinned! Do to us whatever seems best to You; only deliver us this day, we pray.' So they put away the foreign gods from among them and served the LORD. And His soul could no longer endure the misery of Israel. Then the people of Ammon gathered together and encamped in Gilead. And the children of Israel assembled together and encamped in Mizpah. And the people, the leaders of Gilead, said to one another. 'Who is the man who will begin the fight against the people of Ammon? He shall be head over all the inhabitants of Gilead'" (10:15-18).
The people beg and plead for deliverance; they repent and get rid of their idols. They are serious about changing (at least for the time being). They want to be free from their enemies but will accept any other punishment God metes out. God relented. He will raise up another deliverer for them--Jephthah.