In Joshua and Judges, multiple times the Israelites were commanded to or commended when they put entire nations “to the sword” (cf. Judg. 1:8, 25; 4:16) or “devoted them to destruction” (cf. Judg. 1:17; Josh. 2:10; 6:17-18, 21; 7:12; 8:26; 10:1, 28, 35, 37, 39, 40; 11:11-12; 20-21). To our modern sensibilities, this may seem brutal and capricious. Some ask the question: “Does God endorse a form of genocide?”
In his book “Judges for You,” Tim Keller answers this question in a helpful way.