Ibn Buraydah narrates from his father (Sayyiduna Buraydah (may Allah be pleased with him)) that the Messenger of Allah (peace and blessings be upon him) said: "Judges are of three kinds: two judges will go to Hell and one to Paradise: 1. one who knowingly judges unjustly is in Hell; 2. one who judges wrongly out of ignorance and does not fulfil people's rights is also in Hell; 3. one who judges correctly is in Paradise."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب آداب القاضي / 20355