وَنَرَى الصَّلَاةَ خَلْفَ كُلِّ بَرٍّ وَفَاجِرٍ مِنْ أَهْلِ الْقِبْلَةِ
We regard prayer behind every righteous or sinful person among the people of the qibla as valid.
Barr denotes someone righteous; fajir denotes one who acts sinfully. As long as the person remains among Ahl al-Qibla, moral misconduct alone does not necessarily remove that identity. This concerns communal worship, not approval of wrongdoing.