I heard the Messenger of Allah ﷺ say, "Allah does not punish the general public for the deeds of a few, until they see wrongdoing taking place among them and, while being able to denounce it, they fail to do so. When that happens, Allah punishes both the few and the general public."
حدثنا ابن نمير حدثنا سيف قال سمعت عدي بن عدي الكندي يحدث عن مجاهد قال حدثني مولى لنا أنه سمع
سمعت رسول الله ﷺ يقول إن الله عز وجل لا يعذب العامة بعمل الخاصة حتى يروا المنكر بين ظهرانيهم وهم قادرون على أن ينكروه فلا ينكروه فإذا فعلوا ذلك عذب الله الخاصة والعامة
No references are available.
Its isnad is daif due to the unknown status of the narrator from Adi. This is what Haythami said in 7/267. It is found in Tabarani's Al-Kabir 17/138, no. 343, and in Ibn Mubarak's Zuhd 476, no. 1352. Ibn Hajar graded it hasan in Fath al-Bari 13/4, citing it through Ahmad's route, and also attributed it to Abu Dawud.