The writ of habeas corpus ad subjiciendum shall be granted forthwith by the Supreme Court of Appeals, or any circuit court, or any other court given power by any particular statute to grant the same, or any judge of either court in vacation, to any person who shall, by himself or by someone in his behalf, apply for the same by petition, showing by affidavit or other evidence probable cause to believe that he is detained without lawful authority.
The writ shall be directed to the person in whose custody the petitioner is detained and made returnable as soon as may be. If the writ be ordered by any court or judge other than the Supreme Court of Appeals or a judge thereof, it shall be returnable before the court or judge ordering it, if such court or judge be of the county wherein the petitioner is detained; otherwise, before a proper court or judge of the county wherein the petitioner is detained. If the writ be ordered by the Supreme Court of Appeals or a judge thereof, it may be made returnable either before such court or before a proper court or judge of the county wherein the petitioner is detained.
The court or judge granting the writ may previously require bond with security in a reasonable penalty, payable to the person to whom the writ is directed, with condition that the petitioner will not escape by the way, and for the payment of such costs and charges as may be awarded against him It shall be filed with the other proceedings on the writ and may be sued on for the benefit of any person injured by the breach of its condition.
The writ shall be served on the person to whom it is directed, or, in his absence from the place where the petitioner is confined, on the person having the immediate custody of him
If any person on whom such writ is served shall, in disobedience to such writ, fail to bring the body of the petitioner, with a return of the cause of his detention, before the court or judge before whom the writ is returnable, for three days after such service, he shall forfeit to the petitioner $300.
At the direction of the court or judge, the affidavits of witnesses taken by either party, on reasonable notice to the other, may be read as evidence.
The court or judge before whom the petitioner is brought, after hearing the matter both upon the return and any other evidence, shall either discharge or remand him or admit him to bail, as may be proper, and adjudge the costs of the proceedings, including the charge for transporting the prisoner, to be paid as shall seem to be right.
All the material facts proved shall, when it is required by either party, be made a part of the proceedings, which, when they are had in vacation, shall be signed by the judge and certified to the clerk of the court in which the judgment is rendered, and be entered by him among the records of that court.
The judge issuing any such writ in vacation, or the judge before whom it is tried, shall have the same power to enforce obedience to the writ, to compel the attendance of witnesses, or to punish contempt of his authority, as a court has; and his judgment on the trial of the writ, when entered of record as aforesaid, shall be considered and be enforced as if it were a judgment of the court among whose records it is entered.
Any such judgment entered of record shall be conclusive, unless the same be reversed, except that the petitioner shall not be precluded from bringing the same matter in question in an action for false imprisonment.
If, during the recess of the Supreme Court of Appeals, the Governor or the president of the said court should think the immediate revision of any such judgment to be proper, he may summon the court for that purpose to meet on any day to be fixed by him
When the prisoner is remanded, the execution of the judgment shall not be suspended by the writ of error, or suspended for the purpose of applying for one; but where he is ordered to be discharged, and the execution of the judgment to be suspended for the purpose of applying for a writ of error, the court or judge making such suspending order may, in its or his discretion, admit the prisoner to bail until the expiration of the time allowed for applying for the writ of error, or, in case the writ of error be allowed, until the decision of the Supreme Court of Appeals thereon is duly certified.
Writs of habeas corpus ad testificandum may be granted by any circuit court, or any court of record of limited jurisdiction other than a county court, or any judge thereof in vacation, in the same manner and under the same conditions and provisions as are prescribed by this article as to granting the writ of habeas corpus ad subjiciendum, as far as the same are applicable.