It has to be a deterrent rather than punishment, because crimes can't be undone; it's better to prevent them.