If a divinely appointed leader is not infallible (Masum), he would be liable to errors and to deceive others as well. In such a case, no implicit confidence may be placed in his sayings/commands/actions. A divinely appointed Imam is the most liable person to rule as the head of the community, and people are supposed to follow him in every matter.
Now if he commits a sin, people would be bound to follow him in that sin as well, because of their ignorance of whether that action is sin or not (Keep in mind the assumption that Imam is the MOST knowledgeable person in his community). Such a situation is not acceptable by the Grace of Allah since obedience in sin is evil, unlawful, and forbidden. Moreover it would mean that leader should be obeyed and disobeyed at the same time, that is obedience to him is obligatory yet forbidden which is clearly a contradiction and is not commendable.
Besides, if it would be possible for an Imam to commit sin, it would be the duty of other people to prevent him from doing so. (Because every Muslim is obliged to forbid other people from unlawful acts.) In such a case, Imam will be held in contempt, and instead of being the leader of community, he will become their followers, and his leadership will be of no use as far as religion is concerned. Imam is the defender of divine law, and this work can not be entrusted to fallible hands, nor can any such person maintain this task properly. Thus infallibility is an indispensable condition for a divinely appointed Imam or Caliph who is the protector and interpreter of the religious law. Allah, Exalted, stated in Quran that: O you who believe! Obey Allah and obey the Messenger and those vested with authority (Ulul-Amr) from among you. (Quran 4:59).
This verse obliges the Muslims to obey two things: First, to obey Allah; second, to obey Messenger and those vested with authority (Ulul-Amr). The arrangement of the words shows that the obedience of Ulul-Amr is as much obligatory as is the obedience of the Messenger because Quran uses just one verb for both of them without repeating the verb again. Naturally, it means that Ulul-Amr should be of the same importance as the Messenger; otherwise Allah would not have joined them together in this verse (Waw of Atf) under one verb. Interesting to note that Allah employs a separate verb for Himself before mentioning the Messenger and Ulul-Amr which shows that Allah has higher authority than that of the Messenger and Ulul-Amr. It is also clear from the above verse that Ulul-Amr are not restricted to messengers otherwise Allah would only have said: Obey Allah, and Obey Messenger only. But He added Ulul-Amr (those who are given authority by Allah). This is one of the places where the concept of Imams and the necessity of obedience to them come from. In the previous article titled Infallibility of the Prophets, we quoted many verses of Quran to prove the infallibility of the Prophet (PBUHHF).
All those verses proved the following two points: 1. The authority of the Messenger of Allah (PBUHHF) upon the believers was unlimited and all-comprehensive. Any order given by him, under any condition, in any place, at any time, was to be obeyed unconditionally. 2. Supreme authority was given to him because he was sinless (Masum) and free from all types of errors and sins. Otherwise, Allah would not have ordered us to obey him with no questioning or doubt. In that Article, we also gave reference to a tradition in Sahih al-Bukhari which proves that both prophet and divinely appointed Caliphs are infallible (Masum).
Also from the verse 4:59 we concluded that Ulul-Amr have been given exactly the same authority over Muslims as of Messenger, and that the obedience of Ulul-Amr has the same standing as the obedience of the Messenger. It naturally follows that Ulul-Amr must also be sinless (Masum) and free from any type of error, otherwise, their obedience would not have been joined with the obedience of the Prophet and WITHOUT any condition.
The Commander of Believers, Imam Ali (AS), said: The one who disobeys Allah is not to be obeyed; and verily obedience is for Allah and of His Messenger and those vested with authority. Verily, Allah ordered (people) to obey the Messenger because he was sinless and clean (pure), who would not tell people to disobey Allah; and verily He ordered (people) to obey those vested with authority because they are sinless and clean (pure), and would not tell people to disobey Allah. (Ilal al-Sharaye, by Shaikh al-Saduq, v1, p123).