A prison is a facility in which inmates are forcibly confined and denied a variety of freedoms under the authority of the state as punishment for various crimes. Prisons are most commonly used within a criminal justice system: people charged with crimes may be imprisoned until their trial; those pleading or being found guilty of crimes at trial may be sentenced to a specified period of imprisonment. In simplest terms, a prison can also be described as a building in which people are legally held as a punishment for a crime they have committed.