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.
Sunan Abi Dawud Book 25, Hadith 5