If such party is held under illegal restraint or custody, he must be discharged; and if not, he must be restored to the care or custody of the person entitled thereto.
(Enacted 1872.)