Numbers 22:30
And the ass said unto Balaam, Am not I thine ass, upon which thou hast ridden ever since I was thine unto this day? was I ever wont to do so unto thee? And he said, Nay. And the ass said unto Balaam, Am not I thine ass, upon which thou hast ridden ever since I was thine unto this day? was I ever wont to do so unto thee? And he said, Nay.
Balaam was on his way to Balak to curse Israel, against the Lord's command not to curse Israel and in pursuit of his own will. An angel stood in and blocked the way, ready to slay and destroy him for his presumptuous folly in going and for abusing the animal. The ass could see the angel when Balaam could not and turned aside from him, and Balaam mistreated and abused the donkey for it.
By God's power the ass spoke and reminded Balaam that it had faithfully carried him ever since it had been his, and Balaam admitted it had never behaved that way toward him before. He was so blinded by passion and anger and so beside himself with rage that the speaking of the beast struck him as nothing remarkable, and he answered it without wonder. The speech and conduct of the animal exposed his blindness and restrained his violent, reckless course, with the angel acting on the animal's behalf. In this God restrained one who opposed His purpose, as when on his way to curse Israel he was met by an angel.
In the broader narrative to which the verse belongs, Balak conducted Balaam from one point to another in the vain hope of inducing him to change the blessing of Israel into a curse, but the repeated removals failed. Balaam's conduct in the account is an example of working against God through selfishness and covetousness, leaving God out of one's heart and plans. The account shows that God sees cruelty to animals and holds people accountable for it, and may use an animal to confront a person acting perversely. The angel's opposition to Balaam's cruelty warns that God witnesses such treatment and will judge it.