Yahya bin Sa'id (may Allah have mercy on him) said that Umar bin Abd al-Aziz (may Allah have mercy on him) asked about the judge of Kufa and said: A judge should not be a judge unless he has five qualities: (1) he is chaste, (2) forbearing, (3) knowledgeable about (the judgements of) those before him, (4) he consults people of understanding, (5) and he does not care about people's blame.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب آداب القاضي / 20308