1 An accused person shall remain at liberty. He or she may be subjected to compulsory measures involving deprivation of liberty only in accordance with the provisions of this Code.
2 Compulsory measures involving deprivation of liberty must be revoked as soon as:
a.
their requirements are no longer fulfilled;
b.
the term of the measure specified by this Code or by a court has expired; or
c.
alternative measures achieve the same purpose.
3 Remand and preventive detention may not be of longer duration than the anticipated custodial sentence.