A judge or magistrate may, under section 23XWO, order the carrying out of a forensic procedure on an offender if:
(a) the offender is not in custody and has not consented to the forensic procedure (whether or not consent has been sought); or
(b) the offender is in custody and has not consented to the forensic procedure (whether or not consent has been sought); or
(c) under section 23WE, the offender cannot consent to the forensic procedure.