It was narrated that Abu Bakr as-Siddeeq said: O people, you recite this verse: `O you who believe! Take care of your own selves. If you follow the (right) guidance no hurt can come to you from those who are in error` [al-Ma’idah 5:105]. I heard the Messenger of Allah (ﷺ) say: “If the people see an evildoer and do not stop him, soon Allah will send His punishment upon them all.”
Source: sunnah.com
Other translations
Arabic
حَدَّثَنَا يَزِيدُ بْنُ هَارُونَ، قَالَ أَخْبَرَنَا إِسْمَاعِيلُ بْنُ أَبِي خَالِدٍ، عَنْ قَيْسِ بْنِ أَبِي حَازِمٍ، عَنْ أَبِي بَكْرٍ الصِّدِّيقِ، رَضِيَ اللَّهُ عَنْهُ قَالَ أَيُّهَا النَّاسُ إِنَّكُمْ تَقْرَءُونَ هَذِهِ الْآيَةَ {يَا أَيُّهَا الَّذِينَ آمَنُوا عَلَيْكُمْ أَنْفُسَكُمْ لَا يَضُرُّكُمْ مَنْ ضَلَّ إِذَا اهْتَدَيْتُمْ} وَإِنِّي سَمِعْتُ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ يَقُولُ إِنَّ النَّاسَ إِذَا رَأَوْا الظَّالِمَ فَلَمْ يَأْخُذُوا عَلَى يَدَيْهِ أَوْشَكَ أَنْ يَعُمَّهُمْ اللَّهُ بِعِقَابِهِ.
sunnah.com