If it appears that the party is in custody by virtue of process from any court legally constituted or issued by any officer in the course of judicial proceedings before him authorized by law, he can only be discharged under a writ of habeas corpus where:
(1) The jurisdiction of such court has been exceeded, either as to matter, place, sum or person;(2) Though the original imprisonment was lawful, the party has become entitled to his discharge by reason of some subsequent act, omission or event;(3) The process is void in consequence of some defect in matter or substance required by law;(4) The process, though in proper form, was issued in a case or under circumstances not allowed by law;(5) The process is not authorized by any judgment, order or decree nor by any provision of the law; or(6) The person who has the custody of him under any order or process is not the person authorized by law to detain him.Ala. Code § 15-21-24 (1975)
Code 1852, §735; Code 1867, §4286; Code 1876, §4962; Code 1886, §4785; Code 1896, §4838; Code 1907, §7033; Code 1923, §4332; Code 1940, T. 15, §28.