Any person committed for a criminal offense and not brought to trial, as provided by the provisions of this code, is entitled to have the delay inquired into upon a writ of habeas corpus, and the court or judge, upon the return of such writ, shall have power to remand or discharge the applicant or to admit him to bail, with or without sureties as the case may be.
SDCL 21-27-2