The Messenger of Allah ﷺ said, "Judges are of three kinds. Two are in the Fire and one is in Paradise. A man who knew the truth and judged by it is in Paradise. A man who judged among people in ignorance is in the Fire. And a man who acted unjustly in his judgment is in the Fire."We would say that when a judge exercises his utmost effort in reaching a ruling, he is in Paradise.
حدثنا إسمعيل بن توبة حدثنا خلف بن خليفة حدثنا أبو هاشم قال لولا حديث
عن رسول الله ﷺ قال القضاة ثلاثة اثنان في النار وواحد في الجنة رجل علم الحق فقضى به فهو في الجنة ورجل قضى للناس على جهل فهو في النار ورجل جار في الحكم فهو في النار لقلنا إن القاضي إذا اجتهد فهو في الجنة
[Its chain of transmission is daif] Abu Dawud narrated it in the Book of Judgments, chapter on the judge who errs, hadith no. 3573, from the hadith of Khalaf through this route, and it has a corroborating witness narration in Tabarani (Majma: 4/193).