Wa `alaykum as-Salamu wa Rahmatullahi wa Barakatuh.
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
In this fatwa:
2- If the imam is to be criticized for some wrongdoings, that does not mean his Prayer is not acceptable or he should not lead the Prayer. Rather, he should be advised personally by a trustworthy community member.
In response to the question you raised, the European Council for Fatwa and Research (ECFR) issued the following fatwa:
The principle in this matter is that: if one’s prayer is acceptable to himself, then it remains acceptable even if it was led by another. With regard to selecting an imam for Prayer, we must try to follow the statement of Prophet Muhammad (peace and blessings be upon him),
“The Imam is the best at reading the Qur’an. If people are equal in that regard, then the imam is the best knowledgeable of the Sunnah. If they are equal, then the imam is to be the first to have migrated in the way of Allah. If they are equal, then the imam is to be the oldest in age. A man must not become an imam over another in the latter’s home or territory, and must not reside on his premises but with his permission.” (Muslim)
The fact that the imam may commit some breaches in the Shari`ah does not deem his Prayers unacceptable, especially that the scholars agreed that one’s Prayer is acceptable behind a good or a bad imam as long as they are Muslims. It also remains that most of what some people see as wrong-doings, are merely matters of difference in views and opinions, rather than being undeniable breaches of Islam.
For example, praying behind a man who wears a garment which falls under his ankles or one who shaves his beard; all these are matters which people differ over and follow different Fatwas. These acts do not make the person in question liable to be criticized, but rather advised and reminded.
Indeed, one may discover that this person has knowledge in this particular matter which you do not. Therefore, if we state that criticizing the person in question is wrong, then surely praying behind him is acceptable.
Allah Almighty knows best.