If it appears, on the return of the writ, that the prisoner is in custody by virtue of process from any court of this state, or judge or officer thereof, the prisoner shall be discharged in any one of the following cases subject to the restrictions of section 13-4131:
1. When the jurisdiction of the court or officer has been exceeded.
2. When the imprisonment was at first lawful, but by some act, omission or event, which has taken place afterward, the party has become entitled to be discharged.
3. When the process is defective in some matter of substance required by law rendering the process void.
4. When the process, though proper in form, has been issued in a proceeding not authorized by law.
5. When the person having custody of the prisoner is not the person authorized by law to detain him.
6. Where the process is not authorized by a judgment, order or decree of any court, nor by any provision of law.
7. Where a party has been committed on a criminal charge without reasonable or probable cause.