The Prophet ﷺ said, "Help your brother, whether he is the wrongdoer or the wronged."We asked, "Messenger of Allah, we help him when he is wronged, but how do we help him when he is the wrongdoer?"He replied, "You restrain him from wrongdoing. That is how you help him."
حدثنا محمد بن حاتم المكتب حدثنا محمد بن عبد الله الأنصاري حدثنا حميد الطويل
عن النبي ﷺ قال انصر أخاك ظالما أو مظلوما قلنا يا رسول الله نصرته مظلوما فكيف أنصره ظالما قال تكفه عن الظلم فذاك نصرك إياه
[Sahih]. Bukhari also narrated it in "The Book of Wrongs," in the chapter "Help your brother whether he is a wrongdoer or wronged," hadith no. 2444, from the hadith of Humayd al-Tawil, with this wording.On this topic there is also a narration from Ayesha [Tabarani in al-Awsat, 1/377, hadith no. 653].