Where it appears to the competent court that an offender before it, is a young offender and that, by reason of his criminal habits or tendencies or association with persons of bad character, it is expedient that he should be subject to detention for such term under such instruction and discipline as appears most conducive to his reformation, such Court may pass, in lieu of a sentence of imprisonment or of an order of imprisonment under section 123 of the Code, an order for the detention of such offender in a Borstal School established under this Act, or subject to the provisions of section 13, in a Borstal School in any other State in India for such term not being less than three years, nor more than five years as the competent court, subject to rules made under this Act, thinks fit but in no case extending beyond the date on which the offender will, in the opinion of the Court attain the age of twenty-three years:
Provided that before passing such an order, the competent court shall give an opportunity to the parents or the guardians of the said offender to be heard and shall consider any appeal or representation which may be made to it as to the suitability of the case for treatment in such Borstal School and shall be satisfied that the character, state of health and mental condition of the young offender and the other circumstances of the case, are such that such offender is likely to profit by such instruction and discipline, as aforesaid.