The Messenger of Allah ﷺ said, "Allah is with the judge as long as he does not act unjustly. When he acts unjustly, Allah withdraws from him and Satan attaches himself to him."
قال رسول الله ﷺ: إن الله مع القاضي ما لم يجر، فإذا جار تخلى عنه، ولزمه الشيطان.
Tirmidhi narrated it (1330), Ibn Hibban graded it sahih (5062), and Hakim (4/93) and Bayhaqi (10/88) all narrated it, from the hadith of Amr bin Asim, who said, "Imran Qattan narrated to us, from Abu Ishaq Shaybani, from Abdullah bin Abu Awfa," and he related it. The wording is Tirmidhi's, and Ibn Hibban abridged it. Tirmidhi said, "hasan gharib."Ibn Majah (2316) and Bayhaqi both narrated it from the hadith of Muhammad bin Bilal, from Imran Qattan, from Husayn bin Imran Muallim, from Abu Ishaq Shaybani, and he related the hadith, adding to the chain, "Husayn bin Imran Muallim."I say, its chain is hasan, due to the discussion concerning Imran, who is Ibn Dawar, with a fatha on the waw followed by a ra, Abu Awwam, about whom there is disagreement, though his hadith is hasan.From Saeed bin Musayab, who said, "A Muslim and a Jew brought a dispute to Umar bin Khattab. Umar saw that the right was with the Jew, so he ruled in his favor. The Jew said to him, 'By Allah, you have ruled with truth.' Umar bin Khattab struck him with the whip and said, 'How do you know that?' The Jew said to him, 'We find that there is no judge who rules with truth except that on his right and his left there is an angel, guiding him and helping him toward the truth as long as he remains with the truth. But if he abandons the truth, the two of them ascend and leave him.'"Malik narrated it in the chapter on Judgments (2), from Yahya bin Saeed, from Saeed bin Musayab, and he related it.It is narrated from Maqil bin Yasar Muzani, who said, "The Prophet ﷺ ordered me to judge between a people, and I said, 'I am not skilled at judging, O Messenger of Allah.' He said, 'Allah is with the judge as long as he does not intentionally wrong others.'"Ahmad (20305) and Tabarani in al-Kabir (20/529) and in al-Awsat (6504) all narrated it, from the hadith of Nufay bin Harith, from Maqil Muzani, and he related it.Nufay bin Harith is Abu Dawud al-Aama al-Hamadani al-Darimi, daif by the unanimous agreement of the scholars. Ibn Hibban said, "He narrates fabricated reports from trustworthy narrators, mistakenly." Nasai said, "His hadith is abandoned." Bukhari, Abu Hatim, Tirmidhi, and others declared him daif.