Concerning the Imamate there are two issues:
First issue: on affirmation of the Imamate of the Four Khulafa, may Allah be pleased with them. The proof of the Imamate of all of them has three aspects:
First, each of them united the conditions of the Imamate completely;
Second, the Muslims who lived in the time of each one of them were unanimous in pledging allegiance to him and in coming under obedience to him, and consensus is a proof;
Third, that companionship (with the Prophet, ) which each of them had, emigration, majestic deeds, Allah's praise of them, and the Truthful One's bearing witness of the Garden for them. Moreover the Messenger of Allah, may Allah bless him and grant him peace, indicated the Khilafah of Abu Bakr and 'Umar, and he commanded that people model themselves on them. He put Abu Bakr in charge of the Farewell Hajj and made him lead the prayer in his final illness which is an indication of his being appointed Khalifah. Then Abu Bakr appointed 'Umar Khalifah, then 'Umar made the matter the business of consulation among six [people] and they agreed on putting 'Uthman forward. He was wrongfully killed, for which there is the testimony of the Prophet , may Allah bless him and grant him peace, and his promise to him of the Garden for that. Then the man with most right to it was 'Ali because of his noble rank and his sublime virtues. As for that which happened between 'Ali and Mu'awiyah and those Companions with each of them, then the most fitting thing is to withhold oneself from mentioning it, and that they should be remembered in the best way, and that one should seek the best interpretation for them, because it was a matter of ijtihad. As for 'Ali and those with him, they were on the truth because they exercised ijtihad and were correct [in it] and so they will be rewarded. As for Mu'awiyah and those with him, they exercised ijtihad and were mistaken, and they are to be excused. It is required that one respect them and all of the Companions and love them because of the praise of them that occurs in Qur'an and because of their accompanying the Messenger of Allah, may Allah bless him and grant him peace. He, may Allah bless him and grant him peace, said, "Allah! Allah! concerning my companions. Do not make them a target after me. Whoever loves them, then it is for love of me he loves them. Whoever hates them, it is because of hatred of me that he hates them. Whoever harms them has harmed me, and whoever harms me has harmed Allah."
The Second Issue: the pre-conditions of the Imamate are eight:
so that if people agree [on pledging allegiance] to one who does not meet all of the conditions then it is permitted, from fear of causing dissension and sedition.
It is not permitted to rise up against people in authority even if they are tyrannical, unless they openly display clear disbelief. It is obligatory to obey them in whatever a man loves and dislikes, unless they order disobedience [to Allah] for there is no obedience due to a creature it if involves disobedience to the Creator.