Numbers 22:41-23:12
And on the morrow Balak took Balaam and brought him up to Bamoth-ba'al; and from there he saw the nearest of the people. And Balaam said to Balak, "Build for me here seven altars, and provide for me here seven bulls and seven rams." Balak did as Balaam had said; and Balak and Balaam offered on each altar a bull and a ram.
And Balaam said to Balak, "Stand beside your burnt offering, and I will go; perhaps the LORD will come to meet me; and whatever he shows me I will tell you." And he went to a bare height. And God met Balaam; and Balaam said to him, "I have prepared the seven altars, and I have offered upon each altar a bull and a ram."
And the LORD put a word in Balaam's mouth, and said, "Return to Balak, and thus you shall speak." And he returned to him, and lo, he and all the princes of Moab were standing beside his burnt offering.
And Balaam took up his discourse, and said, "From Aram Balak has brought me, the king of Moab from the eastern mountains: `Come, curse Jacob for me, and come, denounce Israel!' How can I curse whom God has not cursed? How can I denounce whom the LORD has not denounced? For from the top of the mountains I see him, from the hills I behold him; lo, a people dwelling alone, and not reckoning itself among the nations! Who can count the dust of Jacob, or number the fourth part of Israel? Let me die the death of the righteous, and let my end be like his!"
And Balak said to Balaam, "What have you done to me? I took you to curse my enemies, and behold, you have done nothing but bless them." And he answered, "Must I not take heed to speak what the LORD puts in my mouth?"