Why did God harden the hearts of Joshua's enemies in Joshua 11?


So that he could destroy them when they fought against Israel.

For it was of the LORD to harden their hearts, that they should come against Israel in battle, that he might destroy them utterly, and that they might have no favour, but that he might destroy them, as the LORD commanded Moses. Joshua 11:20