“No city made peace with the Israelites except the Hivites who inhabited Gibeon; all of them were taken in battle. For it was the Lord’s intention to harden their hearts, so that they would engage Israel in battle, be completely destroyed without mercy, and be annihilated, just as the Lord had commanded Moses.”
Joshua 11:19-20 HCSB
https://www.bible.com/72/jos.11.19-20.hcsb
The Lord hardened the hearts of the people so they would make war. His ways are truly a mystery to me, but it was His intent to annihilate all the inhabitants from the Promised Land, and this is how He did so without putting guilt on the Israelites.