The Shias believe that, like the prophet, an Imam should excel all the Ummah in all virtues, such as knowledge, bravery, piety, charity, etc., and should possess completc knowledge of the Divine Iaw. If it be not so, and this high post be given to a less perfect person when a more perfcct onc is available, the inferior will have been given preference to the superior, which is wrong in the sight of reason and is against the Divine Justice. Therefore, no inferior person can get the Imamat from God when there exists a person superior to him.
The second qualification is ISMAT, ie., infallibility. If thc Imam is not infallible, then he would be liable to error and also to tell lies.
Firstly, in such a case, no implicit confidence can be placed in what he tells and dictates to us.
Secondly, an Imam is the ruler and head of the Ummah and the Ummah should follow him unreservedly in every matter. Now, if he commits any sin the people would be bound to follow him in sin as well. The untenability of such a position is self evident; for obedience in sin is evil, unlawful andforbidden.
Moreover, it would mean that he should be obeyed and disobeyed in one and the same thing, that is obedience to him would be obligatory and forbidden at the same time which is quite absurd.
Thirdly, 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 it is obligatory on every Muslim to forbid other people from unlawful acts). In such case, the Imam will be held in contempt; his prestige will come to an end and instead of being the leader of the Ummah he will become their follower, and his Imamat will be of no use.
Fourthly, the Imam is the defender of the Divine Law and this work cannot be trusted to fallible hands nor can any such person maintain it properly. For this reason, infallibility has been admitted to be an indispensable condition to prophetship; and the considerations which make it essential in the case of a prophet make it so in the case of a caliph as well. For more details, read the book on The Prophethood.
The third qualification is that the Imam should be able to display miracles, for this is the only tangible proof which can reveal the truth of his claim.
Generally speaking any man can claim that he is the Imam or Prophet's caliph and infallible, and miracle is the only unfailing test of truth or falsehood in such cases. If the claimant displays some miracle also in support of his claim it would be admissible without hesitation. If he fails to do so, it will be evident that he does not possess the qualifications required for Imamat and Caliphate, and his claim is false.