Jesus’ letter to Pergamum mentions Balaam and Balak (Revelation 2:14), and that is a signal that the whole message is running along the lines of Numbers 22-25.

The death of the high priest is a sacrificial moment in the life of Israel. According to the rules of the cities of refuge (Numbers 35), the manslayer would remain in a city of refuge until the death of the high priest. After that, he was free to return to the land. The death of the high priest “atones” for the blood that the manslayer has spilled on the land, and the land is cleansed by his death. 

Aaron’s death, recounted in Numbers 21, has a similar effect, releasing Israel from the refuge of the wilderness.

That’s what startles Balak into action. He is king of Moab, and the Moabites and Midianites both are frightened at the people that has come from Egypt and is ready to take the land. So Balak hires Balaam to curse Israel. That utterly fails, as Yahweh turns all his curses into blessings. But that is followed by another effort.

Numbers 25 describes how the daughters of Moab and some of the women of Midian come into the camp, and the people begin to “play the harlot” with the daughters of Moab. This involves offering sacrifice to false gods (v. 2), eating from those sacrifices, and actual fornication (vv. 6-7). A plague breaks out, but Phinehas arrests the plague by impaling a fornicating man and woman and making atonement and winning an imputed righteousness: Justification by impalement. Though Balaam is not mentioned in chapter 25, we later learn that he was behind the effort (Numbers 31:16). When he failed to directly curse Israel, he tried to entice Israel to bring a curse on herself.

The Balaamites and Nicolaitans in Pergamum are not cursing the new Israel, the church, from without, but seeking to corrupt it from within. Satan attempted to intimidate the church into renouncing Jesus – Antipas was killed. That didn’t work, so internal corruption is the next step. Like Balaam, some in the church are seducing the saints to eat food of idolatry and indulge in fornication. 

If the saints at Pergamum do not turn from these Balaamite practices and teachings, Jesus is coming as a new Phinehas, with his sword drawn, to impale the sinners and to stay the plague.