Is prayer valid behind an Imam who is known to be immoral (*Fasiq*)?
Chapter on Imamate and Congregational Prayer
Al-Mughni
Book of Prayer
Primary text
There are two views concerning repetition when praying behind an Imam whose immorality is concealed. A second narration from Ahmad suggests the prayer is valid, which aligns with the view of Ash-Shafi'i, citing the Hadith, "Pray behind whoever says 'La ilaha illa Allah,'" and the fact that the prayer of the Imam himself is valid for him, thus validating followership, as seen by the practice of Ibn 'Umar praying behind Al-Hajjaj and others praying behind Marwan. This implies a consensus that the prayer is valid when there is no fear of harm.
Supporting text
The primary view is that one should not follow an immoral person, based on the narration that the Prophet, peace be upon him, said: "A wicked person shall not lead a righteous man, except if he overcomes him by authority, or he fears his whip or his sword." This Hadith is more specific than the evidence used by the opposing side. The practice of the Companions is interpreted as being done out of fear of harm or political pressure.