Jami` at-Tirmidhi, Book 49, Hadith 299 (Tirmidhi 3996)

Narrated Ubayy bin Ka'b:

that the Messenger of Allah (ﷺ) said: "If it were not for the Hijrah, I would be a man from the Ansar."