Look together at the verses 7:1-2 and 20:16-18 in Deuteronomy.
What commands relate directly to what you see happening in the book of Judges?

A Chosen People
7:1 “When the e Lord your God brings you into the land that you are entering to take possession of it, and clears away many nations before you, f the Hittites, the Girgashites, the Amorites, the Canaanites, the Perizzites, the Hivites, and the Jebusites, seven nations g more numerous and mightier than you, 2 h and when the Lord your God gives them over to you, and you defeat them, then you must i devote them to complete destruction.1 j You shall make no covenant with them and show no mercy to them.

20:16 But u in the cities of these peoples that the Lord your God is giving you for an inheritance, you shall save alive nothing that breathes, 17 but v you shall devote them to complete destruction, 1 the Hittites and the Amorites, the Canaanites and the Perizzites, the Hivites and the Jebusites, as the Lord your God has commanded, 18 that w they may not teach you to do according to all their abominable practices that they have done for their gods, and so you x sin against the Lord your God.

[1] 7: 2 [1] 20:17 That is, set apart (devote) as an offering to the Lord (for destruction)

ESV — Deuteronomy 7:1-2; 20:16-18