In a town by the sea, the Children of Israel were forbidden to fish on the Sabbath. As a test, the fish came to them openly on the Sabbath and stayed away on other days.
Some found tricks to break the prohibition. Another group advised them. A third group said to the advisers: why advise a people whom Allah will destroy or punish severely? They answered:
وَإِذۡ قَالَتۡ أُمَّةٞ مِّنۡهُمۡ لِمَ تَعِظُونَ قَوۡمًا ٱللَّهُ مُهۡلِكُهُمۡ أَوۡ مُعَذِّبُهُمۡ عَذَابٗا شَدِيدٗاۖ قَالُواْ مَعۡذِرَةً إِلَىٰ رَبِّكُمۡ وَلَعَلَّهُمۡ يَتَّقُونَ
“And when a community among them said, "Why do you advise [or warn] a people whom Allāh is [about] to destroy or to punish with a severe punishment?" they [the advisors] said, "To be absolved before your Lord and perhaps they may fear Him."”
Surah Al-A'raf 7:164
Translation: Saheeh International (QuranEnc)
When they had wholly forgotten the reminder, Allah saved those who forbade evil and seized the transgressors with a severe punishment — He made them despised apes.