A security patient is in the custody of the authorised psychiatrist from the time when the security patient is received at the designated mental health service until—
(a) the person ceases to be a security patient under section 295; or
(b) if the authorised psychiatrist discharges the person as a security patient, the person enters the legal custody of the Secretary to the Department of Justice.