When person must be discharged

N.D.C.C. § 32-22-32 — under Habeas Corpus.

N.D.C.C. § 32-22-32

If the party is held under illegal custody or restraint, the party must be discharged or be restored to the care or custody of the person entitled thereto.