Reparation and restraint are the only two reasons why one man may lawfully do harm to another, which is that we call punishment.
Gist of Idea
Reparation and restraint are the only justifications for punishment
John Locke (Second Treatise of Government , 008)
But by 'reparation' does be mean retribution, or compensation? He doesn't rule out capital punishment, but that may qualify as maximum restraint.
Locke,John: 'Two Treatises of Government' [Everyman 1988], p.120