The Code of Criminal Procedure, 1973 (CrPc)
417. Power to appoint place of imprisonment.
(1) Except when otherwise provided by any law for the time being in force, the State Government may direct in what place any person liable to be imprisoned or committed to custody under this Code shall be confined.
(2) If any person liable to be imprisoned or committed to custody under this Code is in confinement in a civil jail the Court of Magistrate ordering the imprisonment or committal may direct that the person be removed to a criminal jail.
(3) When a person is removed to a criminal jail under sub-section (2), he shall, on being released there from, be sent back to the civil jail, unless either-
(a) Three years have elapsed since he was removed to the criminal jail, in which case he shall be deemed to have been released from the civil jail under section 58 of the Code of Civil Procedure, 1908 (5 of 1908) or section 23 of the provincial Insolvency Act, 1920 (5 of 1920), as the case may be; or
(b) The court which ordered his imprisonment in the civil jail has certified to the officer-in-charge of the criminal jail that he is entitled to be released under section 58 of the Code of Civil Procedure, 1908 (5 of 1908) or under section 23 of the Provincial Insolvency Act, 1920 (5 of 1920), as the case may be.