Short Answer: If you have the choice between praying in one masjid behind someone who is known to live in open, obvious sin, or someone who is known to be a good & pious person, of course choose the better option. But if not, you should still pray in congregation behind the best person you can find to lead the prayer.
Thank you for contacting About Islam with your question.
Shaykh Faraz Rabbani from SeekersHub addresses this question in the video below:
Are you’re allowed to read the prayer behind an open sinner?
The prophet (SAWS) said [quoting hadith in Arabic] pray behind every virtuous person and every openly corrupt person.
And that meaning, if you go to the masjid, and there’s someone you know that this guy’s way out there: you pray behind him.
Now, when you have a choice: it’s common sense.
There’s two local masjids.
One there’s someone righteous, one is led by someone who is openly sinful.
You choose virtue. You choose righteousness.
But sometimes when you don’t have a choice, or you’re at work and an uncle leads prayer, but you know him to be, you know, abusive or whatever: you still pray in congregation.
You still pray in congregation.
And we do not create fitna [strife]. We do not create fitna.
Contrary to what some people may appear to believe, fitna is a biddah [innovation] and it had nothing to do with the Sunnah.
So, we avoid that. And where possible, we appoint someone more suitable and we take the means, but in a good way.
I hope this helps answer your question. You can also check out more from SeekersHub at the link here.
Walaikum Asalam. Please keep in touch.
(From AboutIslam’s archives)