to punish sb as a warning to others not to do the same thing
make an example of sb
Definiciones del Oxford Advanced Learner's Dictionary, 9.ª edición