It is narrated from Sayyiduna Anas bin Malik (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: "Love of the Ansar is the sign (that distinguishes) between every believer and hypocrite. So whoever loves the Ansar loves them for the sake of his love for me, and whoever hates the Ansar hates them because of his hatred and enmity towards me."
Imam Abu Ya'la al-Mawsili recorded this hadith, and this narration is also in the Sahih collections, except that its words "So whoever loves the Ansar" to the end are not mentioned there.