Psalm 106:27-31 Amplified Bible (AMP)

27. Cast out their descendants among the nations, and scatter them in the lands [of the earth].

28. They joined themselves also to the [idol] Baal of Peor and ate sacrifices [offered] to the lifeless [gods].

29. Thus they provoked the Lord to anger with their practices, and a plague broke out among them.

30. Then stood up Phinehas [the priest] and executed judgment, and so the plague was stayed. [Num. 25:7, 8.]

31. And that was credited to him for righteousness (right doing and right standing with God) to all generations forever.

Psalm 106