The Midian War documented in Numbers 31 is the final military action that Moses personally led. The people of Midian had already led the people of Israel to sin against God, and this was meant to be the final act of extermination. (However, Midianites still existed well into the days of the Judges.) Moses called forth one thousand males from each of the twelve tribes of Israel and commanded them to destroy the cities and the warriors of Midian. The false prophet Balaam was killed along with the five Midianite kings (31:8)

That only the Midianite women and children were left alive did not satisfy Moses and Israel's leadership; because they "caused the children of Israel, through the counsel of Balaam" to sin against the Lord and sent a plague in the congregation, Moses decreed that every male child be killed (an eerie parallel to Pharaoh's state-sanctioned murder of Hebrew children in Exodus) and that every woman who was not a virgin be killed as well. Those that participated in this killing had to stay outside the camp for seven days of ritual purification.

The high priest Eleazar stated that the word of the Lord given to Moses was that the spoils of war would be divided in half between the warriors and the entire congregation. The people's contribution to the Lord through Eleazar(more specifically, Eleazar and the Levites) would be one of every five hundred people, beeves, asseses, and sheep (31:29). The children of Israel's contribution would be one out of every fifty (30) unto the Levites, the one Israelite tribe not designated an inheritance.

After this sacrifice was made, the "officers which were over thousands of the host" brought unto Moses another offering for the LORD of jewelry as an atonement offering weighing 16,750 shekels. It was made into a memorial before the Lord.