God commanded the Israelites to consecrate all the spoils of this battle to Him since He had given Jericho into their hands as the firstfruits of the land. Rahab and her possessions were exceptions because she had aided the spies. The Israelites were to burn cities under the "ban" (Heb. herem, Joshua 6:17; cf. Deuteronomy 20:16-18) and to kill their inhabitants, including the cattle ( Leviticus 27:29). The only objects they were to spare were metal, gold, silver, and vessels of brass and iron. These they were to place in the treasury of the tabernacle ( Joshua 6:19; Numbers 31:54). The Israelites completely destroyed only three Canaanite cities west of the Jordan along with their populations: Jericho, Ai, and Hazor (lit. enclosure). They captured many others and slew some of their inhabitants. [1] Earlier they had devoted Hormah ( Numbers 21:3), Heshbon ( Deuteronomy 3:1-2), and Og"s towns ( Deuteronomy 3:3) to complete destruction. [source][source][source]
"Joshua is perhaps best known as a book of war. Israel was at war with the Canaanites, but behind these human soldiers God was waging war against sin. Earlier in Israel"s history God was compared to a warrior ( Exodus 14:14; Exodus 15:3; Deuteronomy 1:30; Deuteronomy 3:22; Deuteronomy 20:4). But now Israel experienced His leadership in war as never before. God is constantly at war with sin because it is an affront to His holiness and because it destroys people whom He loves and desires to bless (cf. Romans 6:23)." [2][source]