25
When the Israelites were staying at Shittim the men started to have sex with Moabite women who invited them to the sacrifices made to their gods. The Israelites ate the pagan meals and bowed down before these gods. In this way the Israelites devoted themselves in worship to Baal of Peor, and the Lord was angry with them.
The Lord told Moses, “Arrest all the Israelite leaders and kill them before the Lord where everyone can see* “Where everyone can see”: literally, “before the sun.” in order to turn the Lord's furious anger away from the people.”
So Moses instructed Israel's judges, These were “judge leaders” who fulfilled more than simply a legal role in Israelite society. “Each of you has to kill all of your men who have devoted themselves to worshiping Baal of Peor.”
Right then an Israelite man brought a Midianite woman to his family tent in full view of Moses and all the Israelites as they were crying at the entrance to the Tent of Meeting. When he saw this, Phinehas, son of Eleazar, the son of Aaron the priest, left the assembly, grabbed a spear and followed the man into his tent. There Phinehas drove the spear through both of them, through the Israelite and on into the woman's stomach. This action stopped the plague that had started to kill the Israelites, but 24,000 had already died.
10 The Lord told Moses, 11 “Phinehas son of Eleazar, the son of Aaron the priest, has turned my anger away from the Israelites, because out of all of them he was passionately dedicated to me, so I did not destroy the Israelites in my passionate anger. 12 So make an announcement that I am granting him my peace agreement. 13 It will be an agreement that ensures a permanent priesthood for him and his descendants, because he was passionately dedicated to his God and set the Israelites right.”
14 The name of the Israelite who was killed with the Midianite woman was Zimri, son of Salu, a family leader of the tribe of Simeon. 15 The name of the Midianite woman who was killed was Cozbi, daughter of Zur, a family leader of a Midianite tribe.
16 The Lord told Moses, 17 “Attack the Midianites and kill them, 18 because they attacked you deceptively, leading you astray by using Peor and their woman Cozbi, the daughter of the Midianite leader—the woman who was killed on the day the plague came because of their devotion to Peor.”

*25:4 “Where everyone can see”: literally, “before the sun.”

25:5 These were “judge leaders” who fulfilled more than simply a legal role in Israelite society.