Numbers 22:1-25 NIV
Then the Israelites traveled to the plains of Moab and camped along the Jordan across from Jericho.
Now Balak son of Zippor saw all that Israel had done to the Amorites, and Moab was terrified because there were so many people. Indeed, Moab was filled with dread because of the Israelites.
The Moabites said to the elders of Midian, “This horde is going to lick up everything around us, as an ox licks up the grass of the field.”
So Balak son of Zippor, who was king of Moab at that time, sent messengers to summon Balaam son of Beor, who was at Pethor, near the Euphrates River, in his native land. Balak said:
“A people has come out of Egypt; they cover the face of the land and have settled next to me. Now come and put a curse on these people, because they are too powerful for me. Perhaps then I will be able to defeat them and drive them out of the land. For I know that whoever you bless is blessed, and whoever you curse is cursed.”
The elders of Moab and Midian left, taking with them the fee for divination. When they came to Balaam, they told him what Balak had said.
“Spend the night here,” Balaam said to them, “and I will report back to you with the answer the LORD gives me.” So the Moabite officials stayed with him.
God came to Balaam and asked, “Who are these men with you?”
Balaam said to God, “Balak son of Zippor, king of Moab, sent me this message: ‘A people that has come out of Egypt covers the face of the land. Now come and put a curse on them for me. Perhaps then I will be able to fight them and drive them away.’ ”
But God said to Balaam, “Do not go with them. You must not put a curse on those people, because they are blessed.”
The next morning Balaam got up and said to Balak’s officials, “Go back to your own country, for the LORD has refused to let me go with you.”
So the Moabite officials returned to Balak and said, “Balaam refused to come with us.”
Then Balak sent other officials, more numerous and more distinguished than the first. They came to Balaam and said:
“This is what Balak son of Zippor says: Do not let anything keep you from coming to me, because I will reward you handsomely and do whatever you say. Come and put a curse on these people for me.”
But Balaam answered them, “Even if Balak gave me all the silver and gold in his palace, I could not do anything great or small to go beyond the command of the LORD my God. Now spend the night here so that I can find out what else the LORD will tell me.”
That night God came to Balaam and said, “Since these men have come to summon you, go with them, but do only what I tell you.”
Balaam got up in the morning, saddled his donkey and went with the Moabite officials. But God was very angry when he went, and the angel of the LORD stood in the road to oppose him. Balaam was riding on his donkey, and his two servants were with him. When the donkey saw the angel of the LORD standing in the road with a drawn sword in his hand, it turned off the road into a field. Balaam beat it to get it back on the road.
Then the angel of the LORD stood in a narrow path through the vineyards, with walls on both sides. When the donkey saw the angel of the LORD, it pressed close to the wall, crushing Balaam’s foot against it. So he beat the donkey again.
NIV: New International Version