How can I curse
those whom God has not cursed?
How can I denounce
those whom the LORD has not denounced?
Balak again pleads for him to make the curse. Balaam receives another message from God that he relays to Balak:
God is not a man, that he should lie,
nor a son of man, that he should change his mind.
Does he speak and then not act?
Does he promise and not fulfill?
I have received a command to bless;
he has blessed, and I cannot change it.
A third time Balak tries to sway Balaam but the response is the same. Balak becomes angry and tells Balaam that he will get no reward and that its God's fault. Balaam reminded him that he already said that no matter what was offered to him, he would only speak that which God put in his mouth. He asks Balak to listen to what he has to say because he knows that that Israelites will rise against him. He gives an oracle that Balak and his people will be destroyed and then journeys home.
The story of Balaam is a very interesting side story that Moses probably never even knew happened. I believe it was included to show another follower of God and how God provided (yet again) for the Israelites. Even when they didn't know it, God totally had their back.
Meanwhile, the Israelites have started fornicating with the local women and worshiping Baal (kind of a slap in the face considering God just spared them from a curse). God wants to put all of those who sinned to death.. He's obviously a little bit angry. One of Aaron's sons stops God's rage when he follows a man and woman into a tent and puts a spear through them both. The way it reads it that one was on top of the other and they were speared together...nice. God was so excited that this man shared his zeal for righteousness that He blesses him and his offspring.