Joshua 11, 12: Kings Defeated by Moses and Joshua

There was not a city that made peace with the children of Israel, except the Hivites, the inhabitants of Gibeon. All the others they took in battle. For it was of the Lord to harden their hearts, that they should come against Israel in battle, that He might utterly destroy them, and that they might receive no mercy, but that He might destroy them, as the Lord had commanded Moses.  Joshua 11:19, 20

–> The war of extermination is conducted as God has commanded.