Numbers 25:1-9 While Israel was staying in Shittim, the men began to indulge in sexual immorality with Moabite women, who invited them to the sacrifices to their gods. The people ate and bowed down before these gods. So Israel joined in worshiping the Baal of Peor. And the LORD’s anger burned against them.
The LORD said to Moses, “Take all the leaders of these people, kill them and expose them in broad daylight before the LORD, so that the LORD’s fierce anger may turn away from Israel.”
So Moses said to Israel’s judges, “Each of you must put to death those of your men who have joined in worshiping the Baal of Peor.
Then an Israelite man brought to his family a Midianite woman right before the eyes of Moses and the whole assembly of Israel while they were weeping at the entrance to the Tent of Meeting. When Phinehas son of Eleazar, the son of Aaron, the priest, saw this, he left the assembly, took a spear in his hand and followed the Israelite into the tent. He drove the spear through both of them—through the Israelite and into the woman’s body. Then the plague against the Israelites was stopped; but those who died in the plague numbered 24,000.
Someone told me recently that we all deserve death. In other words, God was totally justified in all the killings since it’s what we all deserve.