9For section 22 substitute—E+W+S+N.I.
“22Special provisions as to patients sentenced to imprisonment, etc
(a)a qualifying patient is detained in custody in pursuance of any sentence or order passed or made by a court in the United Kingdom (including an order committing or remanding him in custody); and
(b)he is so detained for a period exceeding, or for successive periods exceeding in the aggregate, six months,
the relevant application shall cease to have effect on expiry of that period.
(2)A patient is a qualifying patient for the purposes of this section if—
(a)he is liable to be detained by virtue of an application for admission for treatment;
(b)he is subject to guardianship by virtue of a guardianship application; or
(c)he is a community patient.
(3)“The relevant application”, in relation to a qualifying patient, means—
(a)in the case of a patient who is subject to guardianship, the guardianship application in respect of him;
(b)in any other case, the application for admission for treatment in respect of him.
(4)The remaining subsections of this section shall apply if a qualifying patient is detained in custody as mentioned in subsection (1)(a) above but for a period not exceeding, or for successive periods not exceeding in the aggregate, six months.
(5)If apart from this subsection—
(a)the patient would have ceased to be liable to be detained or subject to guardianship by virtue of the relevant application on or before the day on which he is discharged from custody; or
(b)in the case of a community patient, the community treatment order would have ceased to be in force on or before that day,
he shall not cease and shall be deemed not to have ceased to be so liable or subject, or the order shall not cease and shall be deemed not to have ceased to be in force, until the end of that day.
(6)In any case (except as provided in subsection (8) below), sections 18, 21 and 21A above shall apply in relation to the patient as if he had absented himself without leave on that day.
(7)In its application by virtue of subsection (6) above section 18 above shall have effect as if—
(a)in subsection (4) for the words from “later of” to the end there were substituted “ end of the period of 28 days beginning with the first day of his absence without leave ”; and
(b)subsections (4A) and (4B) were omitted.
(8)In relation to a community patient who was not recalled to hospital under section 17E above at the time when his detention in custody began—
(a)section 18 above shall not apply; but
(b)sections 21 and 21A above shall apply as if he had absented himself without leave on the day on which he is discharged from custody and had returned himself as provided in those sections on the last day of the period of 28 days beginning with that day.”