Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:5:49

And judge, ˹O Muhammad˺, between them by what Allah has revealed and do not follow their inclinations and beware of them, lest they tempt you away from some of what Allah has revealed to you. And if they turn away - then know that Allah only intends to afflict them with some of their ˹own˺ sins. And indeed, many among the people are defiantly disobedient.  

And judge between them according to what God has revealed, and do not follow their whims, and beware of them lest they seduce you, ˹lest˺ they lead you astray, from part of what God has revealed to you. But if they turn away, from the judgement revealed, and desire some other, then know that God desires to smite them, with punishment in this world, for some of their sins, ˹those˺ which they have committed, among them, their turning away, and ˹that He desires˺ to requite them for all of their sins in the Hereafter; surely, many of mankind are wicked.
القرآن:٥:٤٩

وَأَنِ احْكُمْ بَيْنَهُمْ بِمَا أَنْزَلَ اللَّهُ وَلَا تَتَّبِعْ أَهْوَاءَهُمْ وَاحْذَرْهُمْ أَنْ يَفْتِنُوكَ عَنْ بَعْضِ مَا أَنْزَلَ اللَّهُ إِلَيْكَ ۖ فَإِنْ تَوَلَّوْا فَاعْلَمْ أَنَّمَا يُرِيدُ اللَّهُ أَنْ يُصِيبَهُمْ بِبَعْضِ ذُنُوبِهِمْ ۗ وَإِنَّ كَثِيرًا مِنَ النَّاسِ لَفَاسِقُونَ  

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