Abdullah bin Masud reported,

There came upon us a time when we were not judging cases and were not in that position. Then Allah عز وجل decreed for us that we reached what you now see. So whoever among you is faced with a case to judge after today, let him judge by what is in the Book of Allah. If a matter comes that is not in the Book of Allah, let him judge by what His Prophet ﷺ judged. If a matter comes that is not in the Book of Allah and His Prophet ﷺ did not judge concerning it, let him judge by what the righteous have judged. If a matter comes that is not in the Book of Allah, nor did His Prophet ﷺ judge concerning it, nor did the righteous judge concerning it, then let him exercise his own reasoning, and let him not say, "I am afraid, I am afraid." For the lawful is clear and the unlawful is clear, and between them are doubtful matters. So leave what causes you doubt for what does not cause you doubt.Abu Abdul-Rahman said, "This hadith is excellent, excellent."

Nasai 5399

Hasan

أخبرنا محمد بن العلاء قال حدثنا أبو معاوية عن الأعمش عن عمارة هو ابن عمير عن عبد الرحمن بن يزيد قال أكثروا على عبد الله ذات يوم

فقال عبد الله

إنه قد أتى علينا زمان ولسنا نقضي ولسنا هنالك ثم إن الله عز وجل قدر علينا أن بلغنا ما ترون فمن عرض له منكم قضاء بعد اليوم فليقض بما في كتاب الله فإن جاء أمر ليس في كتاب الله فليقض بما قضى به نبيه ﷺ فإن جاء أمر ليس في كتاب الله ولا قضى به نبيه ﷺ فليقض بما قضى به الصالحون فإن جاء أمر ليس في كتاب الله ولا قضى به نبيه ﷺ ولا قضى به الصالحون فليجتهد رأيه ولا يقول إني أخاف وإني أخاف فإن الحلال بين والحرام بين وبين ذلك أمور مشتبهات فدع ما يريبك إلى ما لا يريبك قال أبو عبد الرحمن هذا الحديث جيد جيد

النسائي 5399حسن
Contents
Reference
Commentary
Ayat
Collection
Sunan Nasai Sughra
Book
Etiquette of judges
Chapter
Ruling by the consensus of the people of knowledge
Numbering
Darussalam 5399
Nasai 5399