Prayer behind an innovator and a sinner
If an innovation reaches the level of disbelief and polytheism, then its ruling is the same as that of a polytheist. But if it does not, then an innovator or a sinful person should not be appointed as a permanent imam. However, if one has to pray behind him occasionally when there is a need, the prayer will be valid. His ruling is that of a wicked person (fasiq), and the prayer behind him is correct.
(Shawkani (may Allah have mercy on him)) He preferred this view.
Reference: al-Sayl al-Jarrar: 247/1, Nayl al-Awtar: 423/2