The circuit court has jurisdiction to inquire into the cause of detention of all persons confined in the jail of the county or otherwise detained, and to make an order for their recommitment or discharge, or otherwise according to law, and to exercise such other powers as are conferred by the Constitution and statutes of this state.
SDCL 16-6-14