And the Lord spoke to Moses, saying: “Take vengeance on the Midianites for the children of Israel. Afterward you shall be gathered to your people.” So Moses spoke to the people, saying, “Arm some of yourselves for war, and let them go against the Midianites to take vengeance for the Lord on Midian.
And they warred against the Midianites, just as the Lord commanded Moses, and they killed all the males... And the children of Israel took the women of Midian captive, with their little ones, and took as spoil all their cattle, all their flocks, and all their goods.
But Moses was angry with the officers of the army... And Moses said to them: “Have you kept all the women alive? 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. Now therefore, kill every male among the little ones, and kill every woman who has known a man intimately. But keep alive for yourselves all the young girls who have not known a man intimately.
(NUmbers 31:1-3, 7, 9, 14-18 NKJV)
The Lord God told Moses to take vengeance on the Midianites by warring against them. However, it was Moses that decided to kill the women and the male children after they had been taken captive.
The Instructor