What is the maximum period for which an under trial prisoner can be detained in prison?

Section 436A of the Criminal Procedure Code deals with the maximum time period of detention. It states that Where a person has, during the period of investigation, inquiry, or trial under this Code of an offence under any law (not being an offence for which the punishment of death has been specified as one of …
Maximum period of detention

Section 436A of the Criminal Procedure Code deals with the maximum time period of detention. It states that Where a person has, during the period of investigation, inquiry, or trial under this Code of an offence under any law (not being an offence for which the punishment of death has been specified as one of the punishments under that law) undergone detention for a period extending up to one-half of the maximum period of imprisonment specified for that offence under that law, he shall be released by the Court on his personal bond with or without sureties:

Provided that the Court may, after hearing the Public Prosecutor and for reasons to be recorded by it in writing, order the continued detention of a such person for a period longer than one-half of the said period or release him on bail instead of the personal bond with or without sureties:

Provided further that no such person shall, in any case, be detained during the period of investigation, inquiry, or trial for more than the maximum period of imprisonment provided for the said offence under that law.

Explanation.-In computing the period of detention under this section for granting bail, the period of detention passed due to delay in proceeding caused by the accused shall be excluded.

A person accused of a bailable offence has on arrest, a right under Section 436 to be released on bail. (A.I.R. 1965 S.C. 1639). 

The power of a magistrate to grant bail does not depend upon his competence to try the case but on the punishment prescribed for the offence. 

This was held in the case of Aftab Ahmad v. State of U.P., 1990 Cr. L. J. 1636 Allahabad.