"My father wrote to 'Ubaidullah bin Abi Bakrah who was a judge: "Do not pass a judgement between two people while you are angry, for indeed I heard the Messenger of Allah (ﷺ) saying: 'The judge should not judge between two people while he is angry.'"
حَدَّثَنَا قُتَيْبَةُ، حَدَّثَنَا أَبُو عَوَانَةَ، عَنْ عَبْدِ الْمَلِكِ بْنِ عُمَيْرٍ، عَنْ عَبْدِ الرَّحْمَنِ بْنِ أَبِي بَكْرَةَ، قَالَ كَتَبَ أَبِي إِلَى عُبَيْدِ اللَّهِ بْنِ أَبِي بَكْرَةَ وَهُوَ قَاضٍ أَنْ لاَ، تَحْكُمْ بَيْنَ اثْنَيْنِ وَأَنْتَ غَضْبَانُ . فَإِنِّي سَمِعْتُ رَسُولَ اللَّهِ صلى الله عليه وسلم يَقُولُ لاَ يَحْكُمُ الْحَاكِمُ بَيْنَ اثْنَيْنِ وَهُوَ غَضْبَانُ . قَالَ أَبُو عِيسَى هَذَا حَدِيثٌ حَسَنٌ صَحِيحٌ . وَأَبُو بَكْرَةَ اسْمُهُ نُفَيْعٌ .
Tirmizi
The Chapters On Judgements From The Messenger of Allah • Hadith 1346