The Prophet ﷺ said: If anyone seeks the office of judge among Muslims till he gets it and his justice prevails over his tyranny, he will go to Paradise; but the man whose tyranny prevails over his justice will go to Hell. (Using translation from Abū Dāʾūd 3575)
عَنِ النَّبِيِّ ﷺ قَالَ مَنْ طَلَبَ قَضَاءَ الْمُسْلِمِينَ حَتَّى يَنَالَهُ ثُمَّ غَلَبَ عَدْلُهُ جَوْرَهُ فَلَهُ الْجَنَّةُ وَمَنْ غَلَبَ جَوْرُهُ عَدْلَهُ فَلَهُ النَّارُ