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