The judges are coming now, thick and fast, chapter 3 had 3 judges.
The introductory section makes for strange reading directly after Joshua. In Joshua, God delivered the land to them and drove out the foreigners, and chastised them for not finishing the job. Here it says that God left foreigners as a test, to make them have to choose him.
I don’t think this is contradiction but the mind warp of predestination. God’s plan for the Israelites, his law, was that they would stay faithful. But, being born unto sin, they weren’t going to and didn’t. And in the bigger picture it would all lead to the Messiah.
The same will happen with kings. He says they don’t need kings, it is his will that they don’t have kings, but they want kings, they get kings and it becomes god’s plan to bless them through kings like David.
God is very good at plan B. Or was it plan A?
So anyway the cycle of faithlessness starts up and spins fast. Three judges lead them from captivity because of three instances of straying.
The three of them kill oppressor Kings that subjugate the people. Its clear that God allows the subjugation because of their faithlessness. Othniel and Shamgar are warriors. Ehud is an assassin who dispatches the oppressor king in a thriller like plot. But they also keep the people faithful until their death. Their violence against the oppressors is borne of passion for gods people, they aren’t thugs but zealous champions of the faith.