In Numbers 31, the Lord instructs Moses to take vengeance on the Midianites for their role in leading the Israelites astray. The Lord commands Moses to take a thousand men from each of the twelve tribes of Israel and to go to war against the Midianites. Moses follows the Lord's instructions and leads the Israelites in a successful battle against the Midianites. After the battle, Moses and the Israelites return with the spoils of war, including the women and children of the Midianites.
The Lord then instructs Moses to divide the spoils of war among the Israelites. He commands that half of the spoils should be given to the warriors who fought in the battle, and the other half should be given to the rest of the Israelites. The Lord also commands that the women and children of the Midianites should be spared and taken as captives.
The chapter ends with the Lord instructing Moses to purify the Israelites who had been in contact with the dead bodies of the Midianites. This was done to ensure that the Israelites would remain holy and not be contaminated by the pagan practices of the Midianites.
Overall, this chapter of Numbers highlights the Lord's justice and mercy. He commands the Israelites to take vengeance on the Midianites for their role in leading the Israelites astray, but He also commands them to spare the women and children of the Midianites and to purify those who had been in contact with the dead bodies. This shows that the Lord is both just and merciful.