Sahih al-Bukhari, Volume 9, Book 85, Hadith 84 (USC-MSA) ⓘ
Narrated Anas: Allah's Messenger said, "Help your brother whether he is an oppressor or an oppressed," A man said, "O Allah's Messenger! I will help him if he is oppressed, but if he is an oppressor, how shall I help him?" The Prophet said, "By preventing him from oppressing (others), for that is how to help him."
حَدَّثَنَا مُحَمَّدُ بْنُ عَبْدِ الرَّحِيمِ، حَدَّثَنَا سَعِيدُ بْنُ سُلَيْمَانَ، حَدَّثَنَا هُشَيْمٌ، أَخْبَرَنَا عُبَيْدُ اللَّهِ بْنُ أَبِي بَكْرِ بْنِ أَنَسٍ، عَنْ أَنَسٍ ـ رضى الله عنه ـ قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم " انْصُرْ أَخَاكَ ظَالِمًا أَوْ مَظْلُومًا ". فَقَالَ رَجُلٌ يَا رَسُولَ اللَّهِ أَنْصُرُهُ إِذَا كَانَ مَظْلُومًا، أَفَرَأَيْتَ إِذَا كَانَ ظَالِمًا كَيْفَ أَنْصُرُهُ قَالَ " تَحْجُزُهُ أَوْ تَمْنَعُهُ مِنَ الظُّلْمِ، فَإِنَّ ذَلِكَ نَصْرُهُ ".
also referenced under: Book 89, Hadith 13 (In-Book) & Hadith 6952 (DarusSalam)