that the Messenger of Allah (ﷺ) said: "Whoever goes out seeking knowledge, then he is in Allah's cause until he returns."
Jami` at-Tirmidhi Book 41, Hadith 3