Sunan Ibn Majah, Book 13, Hadith 5 (In-Book) ⓘ
It was narrated from 'Abdullah bin Abu Awfa that the Messenger of Allah said: “Allah is with the judge so long as he is not unjust, but if he rules unjustly, He entrusts him to himself.”
حَدَّثَنَا أَحْمَدُ بْنُ سِنَانٍ، حَدَّثَنَا مُحَمَّدُ بْنُ بِلاَلٍ، عَنْ عِمْرَانَ الْقَطَّانِ، عَنْ حُسَيْنٍ، - يَعْنِي ابْنَ عِمْرَانَ - عَنْ أَبِي إِسْحَاقَ الشَّيْبَانِيِّ، عَنْ عَبْدِ اللَّهِ بْنِ أَبِي أَوْفَى، قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم " إِنَّ اللَّهَ مَعَ الْقَاضِي مَا لَمْ يَجُرْ فَإِذَا جَارَ وَكَلَهُ إِلَى نَفْسِهِ " .
also referenced under: Hadith 2312 (Reference) & Volume 3, Book 13, Hadith 2312 (DarusSalam)