This paper develops an economic model of criminal enforcement that combines the goals of deterrence and incapacitation. Potential offenders commit an initial criminal act if the present value of net private gains is positive. A fraction of these offenders become habitual and commit further crimes immediately upon release from their initial prison term (if any). The optimal punishment scheme in this setting generally involves a finite prison term for first-time offenders (based on the goal of deterrence), and an infinite (life) sentence for repeat offenders (based on the goal of incapacitation).