does not rise beyond their ears: the runaway slave until he returns, the woman who passes the night while her husband is displeased with her, and the imam of a people who resent him.’ Al-Tirmidhi narrated this and judged it sound.
Shaykh al-Islām Ibn Taymiyyah said, ‘If the congregation dislike an imam for a religious fault—such as lying, injustice, ignorance, or innovation—and they prefer another person whose religious state is better—more truthful, more knowledgeable, or more devout—then the one they prefer must be appointed, and the man whom they detest has no right to lead them. This accords with the Prophet’s statement ﷺ: “Three people whose prayer does not go beyond their ears: a man who leads a people while they dislike him, a man who only comes to the prayer when it is all but over, and a man who re-enslaves a freed person.”
He also said, ‘If hostility of the sort found among sectarian partisans and followers of erroneous doctrines exists between them, he should not lead them, for the purpose of congregational prayer is to foster unity. The Prophet ﷺ said, “Do not differ, lest your hearts differ.”’
However, if the imam is a man of sound faith and adherence to the sunnah, and they dislike him for precisely that reason, his leadership is not deemed disliked; rather, the blame falls upon those who resent him.
In all situations, harmony between imam and congregation is essential. They must cooperate in righteousness and piety and refrain from quarrelling and mutual hatred born of capricious desires and satanic motives.