Numbers 22:31-35 New International Version (NIV)
31 Then the Lord opened Balaam’s eyes, and he saw the angel of the Lord standing in the road with his sword drawn. So he bowed low and fell facedown.
32 The angel of the Lord asked him, “Why have you beaten your donkey these three times? I have come here to oppose you because your path is a reckless one before me.[a] 33 The donkey saw me and turned away from me these three times. If it had not turned away, I would certainly have killed you by now, but I would have spared it.”
34 Balaam said to the angel of the Lord, “I have sinned. I did not realize you were standing in the road to oppose me. Now if you are displeased, I will go back.”
35 The angel of the Lord said to Balaam, “Go with the men, but speak only what I tell you.” So Balaam went with Balak’s officials.