In his response to this issue, Dr. Hatemal-Haj, associate professor of Fiqh, stated the following points:
1-There is no infallibility except for the prophets, so, a learned individual, though less expected to make mistakes, may still err.
2-The sharia applies to all people even-handedly, and the Messenger of Allah said, “By him in whose hands is my soul, if Fatimah, the daughter of Muhammad were to steal, I would cut her hand.” (Bukhari and Muslim).
3-The prayer behind an Imam and others who commit sins is valid for the companions, like Ibn Omar prayed behind al-Hajjaaj, who was a tyrant. It is however, the duty of the congregation as a whole to replace one who commits grave sins with an imam that is more righteous and will be a role model for the congregation.