They did not destroy the peoples,
as the LORD commanded them,
but they mixed with the nations
and learned to do as they did.
They served their idols,
which became a snare to them.
They sacrificed their sons
and their daughters to the demons;
they poured out innocent blood,
the blood of their sons and daughters,
whom they sacrificed to the idols of Canaan,
and the land was polluted with blood.
Thus they became unclean by their acts,
and played the whore in their deeds.
Psalm 106:34-39 ESV
The majority of this psalm is a recounting of Israel’s unfaithfulness to God, especially in the wilderness, but ultimately leading to the exile. These verses particularly recall Israel’s refusal to utterly destroy the Canaanites as the LORD commanded them to do. Instead, they mingled with the Canaanites, marrying them and becoming like them. The likeness continued to the point of the Israelites sacrificing their children to false gods as the peoples of Canaan did.
While so many today are repelled by the conquest of Canaan and by the genocide that God commanded, this was one of the ultimate reasons why it was necessary. The Canaanites were thoroughly wicked and deserved to be annihilated. These were corrupt and barbaric nations that deserved every ounce of judgment that was to come upon them. The prevalence of child sacrifice was the supreme and only necessary evidence of that fact. And a failure to destroy the Canaanites completely would result in Israel becoming like them, even by imitating the abomination of spilling the blood of their own children.
Thus, God was both judging their wickedness and guarding Israel against the contagion of their wickedness by commanding the Israelites to destroy the Canaanites completely. Although the Israelites may not have understood why such extreme judgment was necessary, their eventual exile was virtually sealed by their refusal to do as God commanded.
Of course, many believe that God’s overall demeanor softened by the time of the New Testament, meaning that He would never command such a thing now; however, consider these words of Jesus:
And if your hand causes you to sin, cut it off. It is better for you to enter life crippled than with two hands to go to hell, to the unquenchable fire. And if your foot causes you to sin, cut it off. It is better for you to enter life lame than with two feet to be thrown into hell. And if your eye causes you to sin, tear it out. It is better for you to enter the kingdom of God with one eye than with two eyes to be thrown into hell, ‘where their worm does not die and the fire is not quenched.’Mark 9:43–48
Jesus is commanding His followers to a holy war no less extreme than the conquest of Canaan. We only think it less extreme because it is no external war against others but an internal war against our own sinful flesh. Yet the principle remains intact. If we make peace with our sin, no matter how insignificant it appears, we fall into the same corruption that Israel did. Christ summons us to fight a holy war against our own sinful flesh. While the decisive battle of this war was won upon the cross, making our victory secure, the conflict will not end until Christ returns or summons us to Him via death. So, put on the whole armor of God, call upon the strength of the Lord, and stand firm against your sin.