"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)
One of the most bitter complaints of critics against the Bible is its portrayal of the severity of God, especially in His command to Moses to destroy all the Canaanites. "When the LORD thy God shall deliver them before thee; thou shalt smite them, and utterly destroy them" (Deuteronomy 7:2). This seems more severe than ever when we read in our text that God Himself hardened the hearts of the Canaanites so that Joshua could destroy them.
But the notion that God is merely a kindly grandfather figure is a self-serving figment of man's sinful imagination. The New Testament reminds us that "our God is a consuming fire" and "the wages of sin is death" (Hebrews 12:29; Romans 6:23), and God doesn't change. "The Lord Jesus shall be revealed from heaven with his mighty angels, In flaming fire taking vengeance on them that know not God, and that obey not the gospel of our Lord Jesus Christ" (2 Thessalonians 1:7-8).
As far as the Canaanites were concerned, God had given them 400 years to repent (Genesis 15:13-16), but each new generation had gone further away from God than the one before, and they were practicing (as archaeology has revealed) every form of debauchery known to man. It was an act of mercy by God toward all those who would come in contact with them in future generations to decree their destruction now. They had already irrevocably hardened their hearts toward God, so God now hardened their hearts against Israel. Thinking they could destroy God's people, they only hastened their well-deserved end. HMM