"And We made them a precedent and an example"—Mujahid said: He means, We made their disbelievers a precedent for the disbelievers of the nation of Muhammad, "and an example for the later ones," meaning: a lesson for those who come after them.
﴿فجعلناهم سلفا ومثلا﴾ قَالَ مُجَاهِد: يَقُول: جعلنَا كفارهم سلفا لكفار أمة مُحَمَّد ﴿وَمَثَلا للآخرين﴾ أَي: عِبْرَة لمن بعدهمْ.