كتاب المقدمات
1
The Book of Miscellany
Anas (May Allah bepleased with him) reported:
Messenger of Allah (ﷺ) said, "Help your brother, whether he is an oppressor or is oppressed". A man enquired: "O Messenger of Allah! I help him when he is oppressed, but how can I help him when he is an oppressor?" He (ﷺ) said, "You can keep him from committing oppression. That will be your help to him".

[Al-Bukhari and Muslim].

وعنه قال‏:‏ قال رسول الله صلى الله عليه وسلم‏:‏ “انصر أخاك ظالمًا أو مظلومًا” فقال رجل‏:‏ يا رسول الله أنصره إذا كان مظلومًا أرأيت إن كان ظالمًا كيف أنصره‏؟‏ قال‏:‏ ‏"‏تحجزه -أو تمنعه- من الظلم فإن ذلك نصره” ‏(‏‏(‏رواه البخاري‏)‏‏)‏‏.‏
Arabic/English book reference : Book 1, Hadith 237