Num 25:3-5

3Thus Israel yoked itself to the Baal of Peor, and the Lord's anger was kindled against Israel.4The 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.”5And 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.”