The main story of Balaam occurs during the sojourn of the Israelites in the plains of Moab, east of the Jordan River, at the close of 40 years of wandering, shortly before the death of Moses and the crossing of the Jordan.
The Israelites had already defeated two kings in Transjordan: Sihon, king of the Amorites, and Og, king of Bashan. Balak, king of Moab, consequently becomes alarmed, and sends elders of Midian and his Moabite messengers, to Balaam, son of Beor, to induce him to come and curse Israel.
Although he was not an Israelite, he was a priest or prophet of the Lord. The king of Moab recognized God’s power in Balaam’s words, saying, “I know that whomever you bless is blessed, and whomever you curse is cursed.” Fearing the strength of the Israelites, the king of Moab sent emissaries asking Balaam to come to Moab and curse the Israelites to rid him of the perceived threat (Num. 22:1-6).
God informs Balaam that he has chosen Israel as a blessed nation and commands Balaam neither to go to Moab nor to curse Israel (Num. 22:12). However, after multiple embassies from the king of Moab, Balaam agrees to go to Moab. His hosts try to bribe him to curse Israel, but Balaam warns them that he will do only what the Lord commands (Num. 22:18).
God seems to agree with this plan, but as Balaam rides his donkey toward Moab, an angel of the Lord blocks his way three times. The angel is invisible to Balaam, but the donkey sees the angel and turns aside each time. Balaam becomes infuriated at the donkey and begins to beat the animal with his staff. “Then the Lord opened the mouth of the donkey, and it said to Balaam, ‘What have I done to you, that you have struck me these three times?’ ” (Num. 22:28).
Balaam converses with the donkey and comes to realize that the animal has perceived the Lord’s guidance far more clearly than Balaam has. Balaam’s eyes are opened; he sees the angel and receives God’s further instructions about dealing with the king of Moab. “Go with the men; but speak only what I tell you,” the Lord reminds him (Num. 22:35).
At the end of the story however, Balak failed in his plans to curse israel.