The common jails in the several counties in the charge of the respective sheriffs, shall be used as prisons:
1. For the detention of persons charged with offenses, and duly committed for trial.
2. For the detention of persons who may be duly committed, to secure their attendance as witnesses on the trial of any criminal cause.
3. For the confinement of persons pursuant to a sentence, upon a conviction for an offense and of all other persons duly committed for any cause authorized by law.
4. For the confinement of persons who may be sentenced to imprisonment in the state prison, until they shall be removed thereto.
R.L. 1910, § 4580.