حَدَّثَنَا إِسْمَاعِيلُ بْنُ تَوْبَةَ، حَدَّثَنَا خَلَفُ بْنُ خَلِيفَةَ، حَدَّثَنَا أَبُو هَاشِمٍ، قَالَ لَوْلاَ حَدِيثُ ابْنِ بُرَيْدَةَ عَنْ أَبِيهِ، عَنْ رَسُولِ اللَّهِ صلى الله عليه وسلم قَالَ ‏"‏ الْقُضَاةُ ثَلاَثَةٌ اثْنَانِ فِي النَّارِ وَوَاحِدٌ فِي الْجَنَّةِ رَجُلٌ عَلِمَ الْحَقَّ فَقَضَى بِهِ فَهُوَ فِي الْجَنَّةِ وَرَجُلٌ قَضَى لِلنَّاسِ عَلَى جَهْلٍ فَهُوَ فِي النَّارِ وَرَجُلٌ جَارَ فِي الْحُكْمِ فَهُوَ فِي النَّارِ ‏"‏ ‏.‏ لَقُلْنَا إِنَّ الْقَاضِيَ إِذَا اجْتَهَدَ فَهُوَ فِي الْجَنَّةِ ‏.‏

Abu Hashim said: “Were it not for the Hadith of Ibn Buraidah from his father, from the Prophet (PBUH) who said: 'Judges are of three types, two of whom will be in Hell and one will be in Paradise. The man who knows the truth and rules in accordance with it, will be in Paradise. The man who passes judgment on the people in ignorance will be in Hell' - we would have said that if the judge does his best he will be in Paradise.” Translation Not Available

Book Ref: Sunan Ibn Majah Book 13 Hadith 2315
Web Ref:  Sunan Ibn Majah Vol 3 Book 13 Hadith 2315