In a famous hadith, `Umar ibn Hanzalah asked Imam Ja`far as-Sadiq, peace be upon him, about the legality of two Shi’ahs seeking a verdict from an illegitimate ruler in a dispute over a debt or a legacy. The Imam’s answer was that it was absolutely forbidden to do so.
Then Ibn Hanzalah asked what the two should do, and the Imam replied: “They must seek out one of you who narrates our traditions, who is versed in what is permissible and what is forbidden, who is well-acquainted with our laws and ordinances, and accept him as judge and arbiter, for I appoint him as judge over you. If the ruling which he based on our laws is rejected, this rejection will be tantamount to ignoring the order of Allah and rejecting us is the same as rejecting Allah, and this is the same as polytheism.”
Shaykh al-Kulayni, Furu`u ‘l-Kafi, vol. 7, p. 412.
In another tradition from Imam Ja’far as-Sadiq, this time narrated by Imam Hasan al-`Askari, peace be upon them, he says, “…but if there is anyone among the fuqaha’ who is in control over his own self, protects his religion, suppresses his evil desires and is obedient to the commands of his Master, then the people should follow him.”
Shaykh at-Tabarsi, al-Ihtijaj, vo. 2, p. 263.
A third hadith is from the Present Imam, Muhammad al-Mahdi, peace be upon him, who said in a reply to Ishaq ibn Ya’qub: “As far as newly occurring circumstances are concerned, you should turn (for guidance) to the narrators of our ahadith, for they are my proof over you just as I am Allah’s proof.”
Shaykh at-Tabarsi, al-Ihtijaj, vo. 2 , p. 283d