In the wake of the Israelite victories over several of the nations/city states on the eastern side of the Jordan River, Balak, King of Moab, is justifiably panicked about the prospect of military confrontation. Knowing he cannot defeat Israel on the battlefield, he hires Balaam, a sorcerer, to curse the Israelites.
On three successive occasions, from different sites overlooking the Israelite encampment, Balaam, at God's behest, praises and blesses the nation. Furious at this betrayal, Balak dismisses Balaam, but not before Balaam delivers a prophecy in which he foretells the defeat of Moab and others at the hands of Israel.
At the next campsite, Shittim, a large number of the Israelite men have sexual liaisons with Moabite and Midianite women and participate in the worship of Baal-Pe'or. While efforts are under way to slay the ringleaders of this group, a plague breaks out in the camp. In the midst of this chaotic situation, one Israelite man commits the brazen act of bringing a Midianite woman into his tent. Pinhas, son of Elazar, the High Priest, follows them and kills them, bringing an end to the plague in which 24,000 people died.