"And his sword drawn in his hand." Now, could he not have slain him even if his sword were not drawn in his hand? And why did he come against him with a sword? Because the craft of Israel is in the voice, and the craft of the nations is the sword. And this wicked Balaam exchanged his craft and took up the craft of Israel, which is the voice, in order to curse them with his voice. Therefore the angel came against him with a sword, to make known to him that if he seizes the craft of Israel, he will fall by the sword — for Israel will take his craft and fell him by the sword. And so it was for him, for thus it is written, "And Balaam son of Beor they slew with the sword" (Numbers 31:8). "And the donkey turned aside from the way." In three places the angel stood. And why so? At first he stood for him on a wide road, where the donkey was able to go to every side, and he hinted to him that if he sought to curse the seed of Abraham, he would have to curse from two sides: the sons of Ishmael and the sons of Keturah. The second time, he stood in a path of the vineyards, a wall on this side and a wall on that side — that if he came to curse the worthy seed of Isaac, he would find there Abraham on one side and Isaac on one side; but it was wide enough that she was pressed to the wall, so that if he sought to curse the seed of Isaac, Esau and Eliphaz he was able to curse. The third time, the angel stood for him on a narrow road, where there was no way that he could turn aside, neither right nor left — that is to say, that if he came to curse Israel he would not be able, for the merit of Abraham and Isaac is on one side, and Jacob and Levi on one side, and the Holy One, blessed be He, from above.
The Angel's Sword and the Three Roads That Stopped Balaam
Midrash Aggadah, Numbers 22:23
וחרבו שלופה בידו. וכי לא היה יכול להרגו אם לא יהיה חרבו שלופה בידו, ומפני מה בא אליו בחרב, כי אומנותן של ישראל בקול, ואומנותן של האומות בחרב, וזה בלעם הרשע החליף אומנותו, ולקח אומנות של ישראל שהיא הקול, כדי לקללם בקולו, לפיכך בא המלאך אליו בחרב, להודיעו שאם יתפוס אומנותן של ישראל יפול בחרב, כי ישראל יקחו אומנותו ויפילו אותו בחרב, וכן היה לו, שכן כתיב ואת בלעם בן בער הרגו בחרב (במדבר לא ח): ותט האתון מן הדרך. בשלשה מקומות עמד המלאך, ולמה כן תחלה עמד לו בדרך רחבה, שהיתה יכולה האתון ללכת לכל הצד, ורמז לו שאם בקש לקלל זרעו של אברהם היה לו לקלל משני צדדים בני ישמעאל ובני קטורה. בשנייה עמד במשעול הכרמים גדר מזה וגדר מזה, שאם בא לקלל זרעו של יצחק הכשר, ימצא שם אברהם מצד אחד, ויצחק מצד אחד, אבל היתה רחבה שנלחצה אל הקיר, שאם בקש [לקלל] זרעו של יצחק עשו ואליפז היה יכול לקלל. בשלישית עמד לו המלאך בדרך צר, אשר אין דרך שיוכל להטות לא ימין ולא שמאל, רצה לומר כי אם בא לקלל את ישראל לא יוכל, שזכות אברהם ויצחק מצד אחד ויעקב ולוי מצד אחד, והקב"ה מלמעלה: