Buraida reported God’s Messenger as saying, "Qadis are of three types, one of whom will go to paradise and two to hell. The one who will go to paradise is a man who knows what is right and gives judgment accordingly; but a man who knows what is right and acts tyrannically in his judgment will go to hell, and a man who gives judgment for people when he is ignorant will go to hell.”
Abu Dawud and Ibn Majah transmitted it.