وَحَدَّثَنِي مَالِكٌ، عَنْ إِسْمَاعِيلَ بْنِ أَبِي حَكِيمٍ، أَنَّهُ سَمِعَ عُمَرَ بْنَ عَبْدِ الْعَزِيزِ، يَقُولُ كَانَ يُقَالُ إِنَّ اللَّهَ تَبَارَكَ وَتَعَالَى لاَ يُعَذِّبُ الْعَامَّةَ بِذَنْبِ الْخَاصَّةِ وَلَكِنْ إِذَا عُمِلَ الْمُنْكَرُ جِهَارًا اسْتَحَقُّوا الْعُقُوبَةَ كُلُّهُمْ ‏.‏

Malik related to me that Ismail ibn Abi Hakim heard Umar ibn Abdal-Aziz say, "Some say that Allah the Blessed, the Exalted, will notpunish the many for the wrong action of the few. However, when theobjectionable action is committed openly, then they all deserve to bepunished." Translation Not Available

Book reference: Muwatta Imam Malik Book 56 Hadith 1836
Web reference: Muwatta Imam Malik Book 56 Hadith 23