Deut. 9:4-6 God explains His actions. He is driving out the Canaanites because
- of the wickedness of the nations
- He made a covenant with Abraham
- (not) because Israel deserves it
In Lev. 18:1-5 God says to Israel that they must not be like the Egyptians, they must not be like the Canaanites. Instead they should obey God’s law, and they will live.
Then (vv. 6-23) follow a whole bunch of laws regarding sexual practices.
Lev. 18:24-25 – “Do not defile yourselves in any of these ways, because this is how the nations that I am going to drive out before you became defiled. Even the land was defiled; so I punished it for its sin, and the land vomited out its inhabitants.”
So the killing of the Canaanites is not genocide or ethnic cleansing, as stories in Joshua 6 and 7 clearly demonstrate. The killing of the Canaanites is punishment for sin, judgment for wickedness.
The creation of a holy, safe space for God’s people (just like Genesis 1!) is also a high priority for God. See Deut. 7:1-8 where God explains how important it is for Israel to completely rid themselves of all temptation to stray from Him.
God does not necessarily fight for Israel. See Joshua 5:13-14. In fact, God judges Israel for sin just as He does the other nations. See Amos 1:3-2:8 – a long passage in which God (through Amos) recites the sins of each nation as justification for God’s punishments. The last two nations in the list are Israel and Judah. He warns them not to long for the Day of The Lord (5:18) because they’re going to end up on the losing side.