Ps 99:8

99:8 an avenger of their wrongdoings. For their own good, and to preserve His holiness, God may punish His people for the sins they commit. Israel knew this because God gave foreign enemies power over them when they persisted in unbelief. This reflects God’s corrective punishment.