While Israel was staying in Acacia Grove, the people began to have sexual relations with the women of Moab.
The women invited them to the sacrifices for their gods, and the people ate and bowed in worship to their gods.
So Israel aligned itself with Baal of Peor, and the LORD's anger burned against Israel.
The LORD said to Moses, "Take all the leaders of the people and execute them in broad daylight before the LORD so that His burning anger may turn away from Israel."
So Moses told Israel's judges, "Kill each of the men who aligned themselves with Baal of Peor."
An Israelite man came bringing a Midianite woman to his relatives in the sight of Moses and the whole Israelite community while they were weeping at the entrance to the tent of meeting.
When Phinehas son of Eleazar, son of Aaron the priest, saw [this], he got up from the assembly, took a spear in his hand,
followed the Israelite man into the tent, and drove it through both the Israelite man and the woman-- through her belly. Then the plague on the Israelites was stopped,
but those who died in the plague numbered 24,000.
The LORD spoke to Moses,
"Phinehas son of Eleazar, son of Aaron the priest, has turned back My wrath from the Israelites because he was zealous among them with My zeal, so that I did not destroy the Israelites in My zeal.
Therefore declare: I grant him My covenant of peace.
It will be a covenant of perpetual priesthood for him and his descendants, because he was zealous for his God and made atonement for the Israelites."
The name of the slain Israelite man, who was struck dead with the Midianite woman, was Zimri son of Salu, the leader of a Simeonite ancestral house.
The name of the slain Midianite woman was Cozbi, the daughter of Zur, a tribal head of an ancestral house in Midian.
"Attack the Midianites and strike them dead.
For they attacked you with the treachery that they used against you in the Peor incident. They did the same in the case involving their sister Cozbi, daughter of the Midianite leader who was killed the day the plague came at Peor."