Al-Harith bin Amr (may Allah have mercy on him), the nephew of Sayyiduna al-Mughirah bin Shu'bah (may Allah be pleased with him), narrates from Sayyiduna Mu'adh bin Jabal (may Allah be pleased with him) that when the Prophet (peace and blessings be upon him) sent him to Yemen, he said to him: "If a case comes before you, how will you judge?" He said: "I will judge according to the Book of Allah." He (peace and blessings be upon him) said: "And if it is not in the Book of Allah?" He said: "Then according to the Sunnah of the Messenger of Allah (peace and blessings be upon him)." He (peace and blessings be upon him) said: "And if it is not in the Sunnah of the Messenger of Allah (peace and blessings be upon him) either?" He said: "I will exert my own judgement (ijtihad) and spare no effort." The narrator said: The Messenger of Allah (peace and blessings be upon him) struck him on his chest and said: "All praise is for Allah, Who has guided the envoy of the Messenger of Allah (peace and blessings be upon him) to what pleases the Messenger of Allah (peace and blessings be upon him)."
Hadith Referenceالمعجم الكبير للطبراني / باب الميم / 17497