(1) If:
(a) an application is made under section 23XWO to a judge or magistrate for an order under that section for the carrying out of a forensic procedure on an offender; and
(b) the offender is in custody or is otherwise detained under a law of the Commonwealth, a State or a Territory ( original custody );
the judge or magistrate may, on the application of a constable, issue a warrant directing the person holding the offender to deliver the offender into the custody ( temporary custody ) of the constable for the hearing of the application.
(2) If the judge or magistrate refuses to make the order under section 23XWO, the constable given temporary custody of the offender must return the offender to the place of original custody without delay.
(3) If the judge or magistrate makes the order under section 23XWO, the judge or magistrate may:
(a) order the constable given temporary custody of the offender:
(i) to convey the offender to the nearest premises where facilities for carrying out the procedure in accordance with this Part are available to that constable; and
(ii) to return the offender to the place of original custody without delay after the procedure is carried out; or
(b) order the constable given temporary custody of the offender to return the offender to the place of original custody without delay.