The destruction of Jericho and all of its citizens (as well as the other cities of Canaan and their citizens), is repeatedly stated to be a judgment from God against them because of their iniquity. See, for a clear example, Deuteronomy 9:4-5. In this passage God says that it is not because Israel is good that she is going in to possess the land, but because the inhabitants of the land are very wicked and God is punishing those nations through Israel. God is also fulfilling His covenant with Abraham, Isaac and Jacob by giving Israel the land promised to them, so God is accomplishing two things by this: punishing the evil and fulfilling His promise to Israel. Earlier in Genesis God told Abraham that He would bring his descendants into the land when the iniquity of the Amorites was full (Gen. 15:16). Therefore God waited for the right time to judge the people of Canaan when their sins had ripened for judgment.
It is common in the Bible for God to use one people to punish another people. Israel was punished by God through the Philistines, Assyrians, and most notably the Babylonians and the Romans. In the case of the Canaanites, God was using Israel to punish their sin. However, it is important to note that God uses a sinful people to punish a sinful people: there is no case of good guys versus bad guys, and God also judges the instruments He uses. The Bible is simply showing one of the ways God works in history with the nations. But whoever God uses, God wants it to be perfectly clear that it is really He who is doing the judging. In Deuteronomy 9:3, He says: "Understand therefore this day, that the LORD your God is He who goes over before you; as a consuming fire He shall destroy them, and He shall bring them down before your face: so shall you drive them out, and destroy them quickly, as the LORD has said unto you."
The question as to whether the Canaanites deserved such a punishment ultimately traces back to our understanding of the seriousness of sin. People wonder how God could have ordered such a thing if He is good. But the truth is, God ordered such a thing precisely because He is good, and takes ethics much more seriously than we do. God takes sin more seriously than we do, and therefore severe judgments are justified in His sight. If we have a low view of sin, almost every punishment will seem extreme and wrong except the most mild. Moreover, a low view of sin is related to a low view of God and a low view of humanity. The Bible teaches that human beings are made in the image of God and therefore have a profound responsibility to live ethically, and that they are held accountable for what they do. To shrink from the idea of punishment is to minimize the ethical accountability of human beings, to treat them like mere animals, and not to treat them as serious moral actors. It has also been said: "There is no little sin, because there is no little God to sin against." The smaller God is in your eyes the smaller sin will be in your eyes, and the smaller punishment will need to be in your eyes. But the Bible is a book about big punishment, big sin, and a big God. It is because all sin is against God, and because God takes the actions of human beings so seriously, that such severe punishments fit the crime. We must listen and learn and not only base our beliefs upon what at first makes sense to our flawed sensibilities. If it is hard for us to see, it is, again, only because we are not seeing sin as it really is.
Look at the cross. As we "survey the wondrous cross on which the Prince of glory died" we will see the seriousness of sin. I would encourage you to spend some time reading Romans chapter 1, 2 and 3. These will help you reflect on sin and what God thinks of it, as they are devoted to the subject of sin in order to show us our need for Christ and the beauty of salvation by grace.
Blessings to you, J----- and D----!
Sincerely, your friend,