Make an example of (someone)

To punish someone as a warning to others.

The teacher punished the student in order to make an example of him for the other students.