The Messenger of Allah ﷺ said, "Allah is with the judge as long as he does not act unjustly. When he acts unjustly, Allah leaves him to himself."
حدثنا أحمد بن سنان حدثنا محمد بن بلال عن عمران القطان عن حسين يعني ابن عمران عن أبي إسحق الشيباني
قال رسول الله ﷺ إن الله مع القاضي ما لم يجر فإذا جار وكله إلى نفسه
[Its isnad is hasan] Tabarani reported it through two routes from Muhammad bin Bilal, as in Tahzib Kamal (printed edition, 6/458). Ibn Adi also reported it, 6/2145, from Ibn Sayd from Ahmad bin Sinan Qattan through him, except that he said "Husayn Muallim," and Bayhaqi reported it through his route, 10/88. The correct form is "Husayn bin Imran," without "Muallim."Tirmidhi reported it, hadith no. 1330, and Bayhaqi and others, from the hadith of Amr bin Asim, who said, Imran Qattan narrated to us from Shaybani from Ibn Abu Awfa through him, and Husayn was not in the chain. Tirmidhi said, "Gharib," and Ibn Hibban graded it sahih (Mawarid), hadith no. 1540, as did Hakim, 4/93, and Dhahabi.