In Numbers 31 we read the following:
Jehovah then told Moses: 2 “Take vengeance for the Israelites on the Mid′i·an·ites. Afterward you will be gathered to your people.” 3 So Moses spoke to the people, saying: “Equip men from among you for battle against Mid′i·an and to execute Jehovah’s vengeance on Mid′i·an. 4 You should send 1,000 of each tribe of all the tribes of Israel into the army.”........... 7 They waged war against Mid′i·an, just as Jehovah had commanded Moses, and they killed every male. 8 Along with the others slain, they killed the kings of Mid′i·an, namely, E′vi, Re′kem, Zur, Hur, and Re′ba, the five kings of Mid′i·an. They also killed Ba′laam+ the son of Be′or with the sword. 9 But the Israelites carried off captive the women and children of Mid′i·an. They also plundered all their domestic animals, all their livestock, and all their possessions. 10 And all their cities in which they had settled and all their encampments they burned with fire. 11 And they took all the spoil and all the plunder, both humans and animals. 12 Then they brought the captives, the plunder, and the spoil to Moses and El·e·a′zar the priest and to the assembly of the Israelites, to the camp in the desert plains of Mo′ab near the Jordan at Jer′i·cho. 13 Then Moses and El·e·a′zar the priest and all the chieftains of the assembly went out to meet them outside the camp. 14 But Moses grew indignant at the appointed men of the combat forces, the chiefs of the thousands and the chiefs of the hundreds who were coming in from the military expedition. 15 Moses said to them: “Have you preserved all the females alive? 16 Look! They are the ones who by Ba′laam’s word induced the Israelites to commit unfaithfulness toward Jehovah over the affair of Pe′or, so that the scourge came upon the assembly of Jehovah. 17 Now you should kill every male among the children and kill every woman who has had sexual relations with a man. 18 But you may keep alive all the young girls who have not had sexual relations with a man [for having sex with them?]
What a lovely God was YHWH!!!