Allah, not disobedience to Him. This makes clear that the imams whom he commanded people to obey in obedience to Allah are not infallible.
Thus, in (1) Sahīh Muslim, Awf ibn Mālik al-Ashjaī said: I heard the Prophet—may Allah bless him and grant him peace—say:
“The best of your leaders are those whom you love and who love you, for whom you pray and who pray for you. The worst of your leaders are those whom you hate and who hate you, whom you curse and who curse you.”
He said: We asked, “O Messenger of Allah, should we not openly oppose them when that happens?” He replied:
“No, so long as they establish prayer among you. Take heed: whoever has a governor appointed over him and sees him commit some act of disobedience to Allah must detest the disobedience to Allah that he commits, but must never withdraw from obedience.” (2)
In [Sahīh] (3) Muslim, it is narrated from Umm Salama that the Prophet (4)—may Allah bless him and grant him peace—said:
“There will be rulers whose deeds you will recognize and condemn. Whoever recognizes the wrongdoing will be free of blame, and whoever condemns it will be safe. The blame, however, lies upon whoever approves and follows.”
They asked, “[O Messenger of Allah] (5), should we not fight them?”
He replied, “No, so long as they pray.” (6)