The Messenger of Allah ﷺ said, "Whoever gives for the sake of Allah, withholds for the sake of Allah, loves for the sake of Allah, hates for the sake of Allah, and gives in marriage for the sake of Allah has perfected his faith."
قال رسول الله ﷺ: من أعطى لله، ومنع لله، وأحب الله، وأبغض لله، وأنكح لله، فقد استكمل إيمانه.
Tirmidhi (2521), Imam Ahmad (15638), and Hakim (2/164) all narrated it through the route of Abdullah bin Yazid Muqri, who said, Saeed bin Abu Ayub narrated to us, from Abu Marhum Abdul-Rahim bin Maymun, from Sahl bin Muaz bin Anas Juhani, from his father, and he mentioned the hadith. Its chain is hasan, and its full referencing was already given in the Book of Faith.His saying, "whoever loves for the sake of Allah," means for His sake, not because his heart is inclined toward him. And his saying, "whoever hates for the sake of Allah," means because of his disbelief, his innovation, and his distance from the way of the early generations, not because of any harm he inflicted or injury he caused.