The Prophet ﷺ said something to the same effect. He said, "Whoever helps in a dispute unjustly has incurred the wrath of Allah ."
حدثنا علي بن الحسين بن إبراهيم حدثنا عمر بن يونس حدثنا عاصم بن محمد بن زيد العمري حدثني المثنى بن يزيد عن مطر الوراق عن نافع
عن النبي ﷺ بمعناه قال ومن أعان على خصومة بظلم فقد باء بغضب من الله عز وجل
No references are available.
[Hasan] Ibn Majah reported it in Al-Ahkam, chapter "One who claims what is not his and disputes over it," no. 2320, from the hadith of Matar Warraq, through him. Muthanna bin Yazid was corroborated by Husayn Muallim, and the preceding hadith serves as a supporting witness for it.