The Old Testament does not set forth a consistent picture of war or battle. In Genesis, Abraham refuses any personal gain as victor after the battle at Siddim (Gen. 14). He also received what appears to be absolution of blood guilt from Melchizedek, the high priest of Jerusalem.
When Levi and Simeon used the rape of their sister Dinah as an excuse to decimate the male population of Shechem, Jacob objected (Gen. 34:30) says that their actions caused Jacob's clan to "stink" among the peoples. Later Jacob pronounced a judgment on their evil deeds. “Cursed be their anger, for it is fierce, and their wrath, for it is cruel! I will divide them in Jacob and scatter them in Israel” (Gen. 49:7). This judgement on Levi and Simeon removes any ambiguity about their deeds. Their slaughter of the entire male population of Shechem was wrong, and their families suffer the consequences.
Some biblical writers present YHWH as a warrior who fights for Israel to install Israel as a kingdom. This meant uprooting the populations that already lived there and toppling the rulers who controlled Canaan, some of whom were Hebrew. The accounts vary. In some, the women and children are taken captive and only the men are killed. In others, all the inhabitants and their livestock are to be destroyed (a holocaust).
The genocide advocated by the Deuteronomist represents an extreme far beyond the Levitical "eye for an eye" which was intended to limit acts of violence and vengeance.
The Deuteronomist is the final hand on the book of Joshua, and even there, the accounts of the Israelite victories are inconsistent. Joshua 11:11 claims that "None of the cities that stood on mounds did Israel burn, except Hazor only; that Joshua burned." However, Joshua 6:24 credits Joshua with burning Jericho, and Joshua 8:28 reports that he also burned Ai.
Israel Finklestein and other archaeologists question the Deuteronomist Historian's claim of the swift invasion of Canaan and the Israelite conquest and destruction of fortified cities such as Jericho and Hazor. The evidence of excavations at those sites does not support the claim. Hershel Shanks has written that archaeology "sometimes provides evidence that seems to refute the Biblical account. That is the case, for example, with the Israelite conquest of the land as described in the Book of Joshua. The various cities that the Israelites supposedly conquered simply cannot be lined up with the archaeological evidence." (BAR, July-August 2013, p. 6)The Deuteronomist advocated destruction of images and places that were sacred to the early Hebrew. The Deuteronomist writes from the context of c.730-300 B.C., long after the time of Moses, and his perspective does not align well with the historical, archaeological, linguistic, and anthropological data concerning Moses and his Hebrew ancestors.
Related reading: Battles in the Bible; INDEX of Topics at Biblical Anthropology; Understanding the Science of Biblical Anthropology; Does the Bible Advocate Genocide?; The Canonical Texts on the Bad Guys