(1) Where a court determines, under section 20BA, that a person who was found unfit to be tried will not become fit to be tried within 12 months after that finding, the court must, at the time of making that determination, also determine:
(a) whether the person is suffering from a mental illness, or a mental condition, for which treatment is available in a hospital; and
(b) if so--whether the person objects to being detained in a hospital.
(2) Where a court has made a determination under subsection (1), the court must:
(a) if the court has determined that the person is suffering from a mental illness, or a mental condition, for which treatment is available in a hospital and that the person does not object to being detained in a hospital--order that the person be taken to and detained in a hospital, or continue to be detained in a hospital, as the case requires; or
(b) otherwise--order that the person be detained in a place other than a hospital, including a prison;
for a period specified in the order, not exceeding the maximum period of imprisonment that could have been imposed if the person had been convicted of the offence charged.
(3) The Attorney-General may, at any time, by order in writing, vary the hospital or other place of detention at which a person is detained under this section.
(4) Where, for urgent medical or security reasons, it becomes necessary to do so, an officer of the State or Territory in which a person is detained under this section may vary the hospital or other place of detention of that person but, where the officer does so, the officer must forthwith notify the Attorney-General, in writing, of the variation and of the reasons for the variation.
(5) Despite subsection (2), the court may, if in the court's opinion it is more appropriate to do so than to make an order under subsection (2), order the person's release from custody either absolutely or subject to conditions to apply for such period as the court specifies in the order, not exceeding 3 years.
(6) The conditions may include:
(a) a condition that the person remain in the care of a responsible person nominated in the order; and
(b) a condition that the person attend upon a person nominated, or at a place specified, in the order for assessment of the person's mental illness, mental condition or intellectual disability and, where appropriate, for treatment; and
(c) any other condition that the court thinks fit.
(7) Where a person has been released from custody subject to conditions, the person or the Director of Public Prosecutions may, at any time, apply to the court to vary those conditions.
(8) Where a court determines, under subsection 20BA(4), that a person who was found unfit to be tried will not become fit to be tried, within 12 months after the finding, the finding that there is, on the balance of probabilities, a prima facie case for the commission of the offence charged acts as a stay against any proceedings, or any further proceedings, against the person, in respect of the offence.