Sunan Abi Dawud, Hadith 3585 ⓘ
Some companions of Mu'adh ibn Jabal said: When the Messenger of Allah intended to send Mu'adh ibn Jabal to the Yemen, he asked: How will you judge when the occasion of deciding a case arises? He replied: I shall judge in accordance with Allah's Book. He asked: (What will you do) if you do not find any guidance in Allah's Book? He replied: (I shall act) in accordance with the Sunnah of the Messenger of Allah. He asked: (What will you do) if you do not find any guidance in the Sunnah of the Messenger of Allah and in Allah's Book? He replied: I shall do my best to form an opinion and I shall spare no effort. The Messenger of Allah then patted him on the breast and said: Praise be to Allah Who has helped the messenger of the Messenger of Allah to find something which pleases the Messenger of Allah.
حَدَّثَنَا حَفْصُ بْنُ عُمَرَ، عَنْ شُعْبَةَ، عَنْ أَبِي عَوْنٍ، عَنِ الْحَارِثِ بْنِ عَمْرِو بْنِ أَخِي الْمُغِيرَةِ بْنِ شُعْبَةَ، عَنْ أُنَاسٍ، مِنْ أَهْلِ حِمْصَ مِنْ أَصْحَابِ مُعَاذِ بْنِ جَبَلٍ أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم لَمَّا أَرَادَ أَنْ يَبْعَثَ مُعَاذًا إِلَى الْيَمَنِ قَالَ " كَيْفَ تَقْضِي إِذَا عَرَضَ لَكَ قَضَاءٌ " . قَالَ أَقْضِي بِكِتَابِ اللَّهِ . قَالَ " فَإِنْ لَمْ تَجِدْ فِي كِتَابِ اللَّهِ " . قَالَ فَبِسُنَّةِ رَسُولِ اللَّهِ صلى الله عليه وسلم . قَالَ " فَإِنْ لَمْ تَجِدْ فِي سُنَّةِ رَسُولِ اللَّهِ صلى الله عليه وسلم وَلاَ فِي كِتَابِ اللَّهِ " . قَالَ أَجْتَهِدُ رَأْيِي وَلاَ آلُو . فَضَرَبَ رَسُولُ اللَّهِ صلى الله عليه وسلم صَدْرَهُ وَقَالَ " الْحَمْدُ لِلَّهِ الَّذِي وَفَّقَ رَسُولَ رَسُولِ اللَّهِ لِمَا يُرْضِي رَسُولَ اللَّهِ " .
also referenced under: Hadith 3592 (DarusSalam) & Book 24, Hadith 3585 (USC-MSA)