Jami` at-Tirmidhi, Book 41, Hadith 3 (Tirmidhi 2717)

Narrated Anas bin Malik:

that the Messenger of Allah (ﷺ) said: "Whoever goes out seeking knowledge, then he is in Allah's cause until he returns."