Numbers 31:12-18 New King James Version (NKJV)
Return from the War
12 Then they brought the captives, the booty, and the spoil to Moses, to Eleazar the priest, and to the congregation of the children of Israel, to the camp in the plains of Moab by the Jordan, across from Jericho. 13 And Moses, Eleazar the priest, and all the leaders of the congregation, went to meet them outside the camp. 14 But Moses was angry with the officers of the army, with the captains over thousands and captains over hundreds, who had come from the battle.
15 And Moses said to them: “Have you kept all the women alive? 16 Look, these women caused the children of Israel, through the counsel of Balaam, to trespass against the Lord in the incident of Peor, and there was a plague among the congregation of the Lord. 17 Now therefore, kill every male among the little ones, and kill every woman who has known a man intimately. 18 But keep alive for yourselves all the young girls who have not known a man intimately.