Numbers 22:23
And the ass saw the angel of the LORD standing in the way, and his sword drawn in his hand: and the ass turned aside out of the way, and went into the field: and Balaam smote the ass, to turn her into the way. And the ass saw the angel of the LORD standing in the way, and his sword drawn in his hand: and the ass turned aside out of the way, and went into the field: and Balaam smote the ass, to turn her into the way.
The verse belongs to Balaam's journey to curse Israel at Balak's bidding, when an angel met him in the way. He went from covetousness, selfishness, and love of honor and gain, trying to satisfy Balak and to please both God and man while professing obedience, when he could have excused himself and stayed. Selfishness and covetousness had entered his heart and plans, so that in working against God he became an example of those who hinder God's work by letting their own plans take precedence over obedience.
God's anger was kindled against Balaam for going, and He sent His angel with drawn sword to stand in the way to withstand and slay him for presumptuous folly in defying God's will, because his way was perverse before Him. Balaam could not see the angel, but the ass saw him standing in the way with sword drawn and turned aside out of the way into the field to avoid him. Balaam struck and beat her to force her back into the way and onto the road.
He was blinded by passion and beside himself with rage, so that even the speaking of the beast seemed nothing remarkable to him. The ass's turning aside was part of God's effort to stop Balaam on his perverse path and saved his life. The same meeting illustrates how God uses unseen angels to stop a person bent on evil and restrain human intent.
When the angel revealed himself Balaam was terrified and bowed in humility. The angel said he came to withstand him because his way was perverse, warned him against gratifying the Moabites, and then permitted him to go on so God could glorify His name before Israel's enemies by showing that even a covetous man dared not curse Israel for promises of promotion or reward. The angel witnessed Balaam's cruelty and spoke in defense of the abused animal, for God sees and opposes cruelty to animals, mistreating creatures entrusted to one's care comes from a perverse spirit, and people will answer to Him and be held accountable for it. Balak's conducting Balaam from one point to another in the vain hope of turning Israel's blessing into a curse repeatedly failed, showing steadfastness sustained by divine power against which human applause and fear of man are powerless.