عن معاذ بن جبل رضى الله عنه ان النبى حين بعثه الى اليمن قال له : كيف تقضي اذا عرض لك قضاء؟ قال : اقضي بما فى كتاب الله قال : فان لم يكن فى كتاب الله؟ قال : بسنة رسول الله ، قال : فان لم يكن فى سنة رسول الله ، قال : اجتهد راي لا الو ، قال : فضرب رسول الله صلى الله عليه وسلم صدره ، قال : الحمد لله الذى وفق رسول الله لما يرضي رسول الله صلى الله عليه وسلم
Hazrat Mu'adh bin Jabal (may Allah be pleased with him) narrates that when the Noble Prophet (peace and blessings be upon him) sent him to Yemen, he asked him, "When cases are presented before you, how will you decide them?" He replied, "I will decide according to the Book of Allah." The Prophet (peace and blessings be upon him) said, "If the matter is not found in the Book of Allah?" He replied, "Then I will decide according to the Sunnah of the Messenger of Allah (peace and blessings be upon him)." The Prophet (peace and blessings be upon him) again said, "If the matter is not found in the Sunnah of the Messenger either?" He replied, "Then I will exercise my own judgment (ijtihad) and will not spare any effort." Upon this, the Prophet (peace and blessings be upon him) struck his chest with his hand and said, "All praise is due to Allah Who has granted the messenger of the Messenger of Allah the ability to do that which pleases the Messenger of Allah."