The Ruling on Prayer behind Innovators
Question :
Some (scholars) rule that it is not permissible to pray behind an Imam who is an innovator and disparages many of the Sunan, in spite of the fact that the Hadith says: "Pray behind every righteous person and every immoral person." So is it permissible to pray behind such an Imam or not?
Answer:
This Hadith which the questioner has indicated: "Pray behind every righteous person and every immoral person." is baseless with this wording. But there is no doubt that prayer behind a person who fears Allah more and is stronger in religion is better than prayer behind one who scorns the religion of Allah. And the innovators may be divided into two categories: Those innovators who are guilty of disbelief and those innovators who are not. As for the former, prayer behind them is not correct, because they are disbelievers, while as for the latter, it is subject to the differences of opinion among the scholars regarding prayer behind sinners, but the most authoritative view is that prayer behind a sinner is permissible, unless there is a benefit in abandoning prayer behind them, such as when it causes them to abstain from sin, in which case, it is better not to pray behind them.
Source:
Ibn 'Uthaimin
Fatawa Islamiyah, Vol. 2 Pages 217-218