Abu Bakr reported,

People, you recite this verse, "You who believe, take care of your own souls. Those who go astray cannot harm you if you are rightly guided" [Maidah 5:105]. But I heard the Messenger of Allah ﷺ say, "When people see a wrongdoer and do not restrain his hand, Allah is about to engulf them all in a punishment from Himself."Muhammad bin Bashshar narrated to us, Yazid bin Harun narrated to us from Ismail bin Abu Khalid something similar.

Tirmidhi 2168

Sahih

حدثنا أحمد بن منيع حدثنا يزيد بن هارون أخبرنا إسمعيل بن أبي خالد عن قيس بن أبي حازم

عن أبي بكر الصديق أنه قال

أيها الناس إنكم تقرءون هذه الآية {يا أيها الذين آمنوا عليكم أنفسكم لا يضركم من ضل إذا اهتديتم} وإني سمعت رسول الله ﷺ يقول إن الناس إذا رأوا الظالم فلم يأخذوا على يديه أوشك أن يعمهم الله بعقاب منه حدثنا محمد بن بشار حدثنا يزيد بن هارون عن إسمعيل بن أبي خالد نحوه

الترمذي 2168صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami Tirmidhi
Book
Tribulations
Chapter
Descent of punishment if evil is not changed
Numbering
Darussalam 2168
Tirmidhi 2168