While Israel was staying at Shittim, the people began to have sexual relations with the women of Moab.
These invited the people to the sacrifices of their gods, and the people ate and bowed down to their gods.
Thus Israel yoked itself to the Baal of Peor, and the Lord's anger was kindled against Israel.
The Lord said to Moses, "Take all the chiefs of the people, and impale them in the sun before the Lord, in order that the fierce anger of the Lord may turn away from Israel."
And Moses said to the judges of Israel, "Each of you shall kill any of your people who have yoked themselves to the Baal of Peor."
Just then one of the Israelites came and brought a Midianite woman into his family, in the sight of Moses and in the sight of the whole congregation of the Israelites, while they were weeping at the entrance of the tent of meeting.
When Phinehas son of Eleazar, son of Aaron the priest, saw it, he got up and left the congregation. Taking a spear in his hand,
he went after the Israelite man into the tent, and pierced the two of them, the Israelite and the woman, through the belly. So the plague was stopped among the people of Israel.
Nevertheless those that died by the plague were twenty-four thousand.
The Lord spoke to Moses, saying:
"Phinehas son of Eleazar, son of Aaron the priest, has turned back my wrath from the Israelites by manifesting such zeal among them on my behalf that in my jealousy I did not consume the Israelites.
Therefore say, "I hereby grant him my covenant of peace.
It shall be for him and for his descendants after him a covenant of perpetual priesthood, because he was zealous for his God, and made atonement for the Israelites.' "