Bamidbar 22:22:
ויחר אף אלהים כי הולך הוא ויתיצב מלאך השם בדרך לשטן לו והוא רכב על אתנו ושני נעריו עמו.
Translation: God’s wrath flared because he was going, and an angel of the Lord stationed himself on the road to thwart him, and he was riding on his she-donkey, and his two servants were with him.
Rashi:
לשטן לו, מלאך של רחמים היה והיה רוצה למנעו מלחטוא שלא יחטא ויאבד.
“To thwart him”, This was an angel of mercy seeking to prevent [Bil’am] from sinning and being destroyed because of it.
Note: I think the hermeneutic is from the word “Lo”, which implies “to his benefit”.