Some criminals will refuse to be rehabilitated, but at least we can try. Obviously, if the state kills the prisoner, it is no longer possible to make him a better person, so rehabilitation excludes capital punishment. The third legitimate reason for punishment is deterrence. Having predictable punishment and swift enforcement prevents other potential criminals from committing a similar crime. Some studies have concluded that capital punishment is not a greater deterrent than imprisonment.
Some prisoners even prefer death to a lifetime in prison.
Even if the death penalty deters crime, deterrence alone does not justify the penalty. The death penalty might deter shoplifting, but most folks would agree this would be a rather excessive penalty for minor theft. Deterrence has to be balanced with the human rights that even criminals have. The fourth reason for proper punishment is the restitution of the damage. If a thief steals property, he is morally obliged to return the property to the victim, or property of similar type or value.