We find in a couple of places in Nahjul Balagha quotes that legitimize the rule of fallible caliphs.
In Saying #73, we find Ali giving advice to those that would one day assume power, “Whoever places himself in a position of Imamate, he should start by teaching himself before teaching others. He should discipline with his actions before disciplining with his words, and one who teaches and disciplines himself is more entitled to esteem than one who teaches and disciplines others.”
Much can be extracted from the above words of Ali to future caliphs. Most importantly, he is of the opinion that they should be looked at with high regard if they were the type that disciplined themselves. Such words legitimize fallible caliphs, since if he believed them to be usurpers of the Imamate, he would have not said that they deserve any esteem.
It is also very clear that he is not referring to the other eleven Imams, since the infallible Imams do not need to teach or discipline themselves in the first place.
Moreover, in a famous letter #6 (245) to Mu’awiyah, he wrote, “Verily, those who swore allegiance to Abu Bakr, Omar, and Uthman have sworn allegiance to me on the same basis on which they swore allegiance to them. Thus, who was present has no choice (to consider), and he who was absent has no right to reject; and consultation is confined to the Muhajiroon and the Ansar. If they agree on an individual and take him to be Caliph it will be deemed to mean Allah’s satisfaction.”
The text is clear that Ali believed that the choice of the Muhajireen and Ansar of a caliph is evidence of Allah’s satisfaction in that choice. For those curious to read more about Ali’s praise for the Sahaba in general and for the Muhajireen and Ansar in specific, please refer to our Sahaba section.