After the people "commit whoredom with the daughters of Moab," Moses has them all killed. Then God tells Moses to
hang their dead bodies up in front of him; God says that this will satisfy him. 25:1-5
Under God's direction, Moses' army defeats the Midianites. They kill all the adult males, but take the women and
children captive. When Moses learns that they left some live, he angrily says: "Have you saved all the women alive? Kill
every male among the little ones, and kill every woman that hath known man by lying with him. But all the women children,
that have not known a man by lying with him, keep alive for yourselves." So they went back and did as Moses (and
presumably God) instructed, killing everyone except for the virgins. In this way they got 32,000 virgins -- Wow!
(Even God gets some of the booty -- including the virgins.) 31:1-54