Midrash · Aggadah

Midrash Tanchuma, Beshalach 4/מדרש תנחומא·בשלח ד׳

א‎וַה' הֹלֵךְ לִפְנֵיהֶם. בַּמִּדָּה שֶׁאָדָם מוֹדֵד, בָּהּ מוֹדְדִים לוֹ. אַבְרָהָם לִוָּה מַלְאֲכֵי הַשָּׁרֵת, שֶׁנֶּאֱמַר: וְאַבְרָהָם הֹלֵךְ עִמָּם לְשַׁלְּחָם (בראשית יח, טז). לְפִיכָךְ לִוָּה הַקָּדוֹשׁ בָּרוּךְ הוּא אֶת בָּנָיו בַּמִּדְבָּר אַרְבָּעִים שָׁנָה. אַבְרָהָם אָמַר יֻקַּח נָא (וכו', וירא ד).
1And the Lord went before them (Exod. 13:21). Just as a man treats other men, so is he treated. Because Abraham escorted the ministering angels, as it is said: And Abraham went with them to bring them on the way (Gen. 18:16), the Holy One, blessed be He, accompanied his sons in the wilderness for forty years. And because Abraham said: Let now a little water be fetched (ibid., v. 4), as is written in the portion And He appeared unto him (Gen. 18:1), the Holy One, blessed be He, caused the well to appear for his children.