The purpose of criminal law is to protect society by facilitating the detection and prosecution of criminal actions while protecting the rights of the accused. Cornell University describes criminal law as the means by which the state prosecutes and punishes individuals charged with violating the law.
Wikipedia cites five basic theories underpinning the purpose of criminal law. Retribution is one of the most commonly held reasons for criminal law, as it is felt that criminals deserve suffering for having broken the law. Deterrence is another purpose. With deterrence, it is argued, others might be dissuaded from breaking the law after seeing the punishment of convicted persons. Incapacitation is also advanced as a purpose for criminal law. In this sense, the criminal is rendered harmless simply by being removed from society for the duration of the prison term. Rehabilitation is sometimes advocated for those convicted of illegal activities. It is sometimes attempted through job training, remedial education and placement in drug and alcohol treatment programs. Finally, restoration is occasionally cited as a function of the legal system. This principle borrows much from civil law and sees the purpose of criminal courts as encouraging the guilty to make restitution for their crimes.