The Messenger of Allah ﷺ said, "When a judge issues a ruling, exerting his utmost effort, and gets it right, he receives two rewards. When he issues a ruling, exerting his utmost effort, and gets it wrong, he receives one reward."I related this to Abu Bakr bin Hazm, who said, "This is exactly how Abu Salama narrated it to me from Abu Hurairah."
حدثنا عبيد الله بن عمر بن ميسرة حدثنا عبد العزيز يعني ابن محمد أخبرني يزيد بن عبد الله بن الهاد عن محمد بن إبراهيم عن بسر بن سعيد عن أبي قيس مولى عمرو بن العاص
قال رسول الله ﷺ إذا حكم الحاكم فاجتهد فأصاب فله أجران وإذا حكم فاجتهد فأخطأ فله أجر فحدثت به أبا بكر بن حزم فقال هكذا حدثني أبو سلمة عن أبي هريرة
Reported by Muslim in Aqdiyah, chapter "The reward of the judge when he exercises judgment and is correct or mistaken," hadith 1716, from the hadith of Abdul-Aziz Darawardi, and Bukhari in Itisam bil-Kitab wal-Sunnah, chapter "The reward of the judge when he exercises judgment and is correct or mistaken," hadith 7352, from the hadith of Ibn Hadi, with the same wording.