Balak, king of Moab, sees the Israelites having just conquered the Emorites and other Canaanites, the two mighty neighbors of Moab, is concerned that his nation would be the next target of the Israelites. He sends emissaries to the Land of Midian, to Bilaam, a famed gentile prophet and sorcerer, asking him to come and curse the Jews, and save Moab from destruction. G‑d appeared in a dream to Bilaam that night and instructed him not to go to Moab.
Bilaam responds to Balak’s emissaries that G‑d doesn’t permit him to go with them. Balak sends more prominent emissaries to Bilaam, promising him unlimited treasures in return for his skills. Once again, G‑d appeared to Bilaam, permitting him to go if he only speaks the words which G‑d dictates to him.
Bilaam departs with Balak’s emissaries, on his trusted she-donkey. On the way, G‑d sends an angel with a drawn sword to block Bilaam’s trail. Bilaam couldn’t see the angel, however, the she-donkey sees the angel of God standing with a sword in his hand and turns the other way. Bilaam hits the donkey to get her back on the path. Three times this angel leads the donkey away from the path and three times Bilaam hits his donkey in anger. Miraculously G-d opens the mouth of the donkey, reprimanding Bilaam for striking her. Eventually, G‑d “opens Bilaam’s eyes,” and he sees the angel. Bilaam is rebuked for hitting his donkey, and is reminded by the angel only to say what G‑d orders him to say.
Bilaam reaches Balak and says, “I am here but whatever words G-d puts into my mouth I will say”. Bilaam instructs, Balak to builds seven altars and offers sacrifices to G‑d. Bilaam, begins and whatever G-d dictates to him he repeats to Balak and his ministers. Bilaam then proceeded to bestow the Israelites with beautiful blessings and praises. Balak responds angrily to the blessings, Bilaam reminds him that he can only say that which G‑d puts in his mouth to say. The process is repeated three times; they build altars and bring offerings in different places, and for a third time, only blessings are uttered from Bilaam’s mouth. At this point, Balak was furious of not accomplishing his goal, sends Bilaam away.
Before leaving, Bilaam foretells the end of Moab, in a distant future, at the hand of the Israelites. He also declares the eventual destruction of Esau, Amalek and Assyria.
The Israelites then settle in Shittim and the people began to sin with the daughters of Moab and Midian, who seduce many of the Israelite men to worship the Moabite Baal Peor deity. G‑d angrily commands Moses to punish the guilty people, and simultaneously a lethal plague erupts amongst the Israelites. A prince from the Tribe of Simeon, Zimri, publicly displays the Midianite princess with whom he was consorting. Pinehas, Aaron’s grandson, kills them both, and the plague is halted.