Deterrence (legal)

the use of punishment as a threat to deter people from offending

In law, the term deterrence is used to describe the situation where punishment or threat is used to keep people from committing a crime. Both the person who committed a crime, as well as other people should be kept from committing that kind of crime.