Charles Weller was convicted in the police court of the city of Bisbee of the crime of vagrancy as defined and denounced by a city ordinance of that city. He was tried by the police judge without a jury, although on'e was demanded, and fined $50 or 50 days’ imprisonment in the city jail in default of its payment. He thereupon took an appeal to the superior court of Cochise county-by giving notice and filing appeal bond as required by law. On the day set for trial in the superior court, he surrendered himself into the custody of the city marshal of the city of Bisbee, and thereupon filed a petition in said superior court for a writ of habeas corpus, alleging he had been denied a jury tidal as the sole reason why his imprisonment was illegal. The court ordered the issuance of the writ, and upon final hearing thereon directed the discharge of the appellee from custody. The state has appealed from the judgment upon questions of law.
From the stipulated facts, it appears that the trial of appellee’s case was set for March 11, 1917, in the superior court, where it was then pending on appeal prosecuted by him; that on that date he voluntarily surrendered himself into custody, and applied to the court in which his appeal was pending for a writ of habeas corpus.
We believe it to be an absolutely well-founded rule that one may not procure his own imprisonment, as by voluntarily surrendering himself into custody, and thereafter secure a discharge therefrom by the aid of this writ. In re Gow, 139 Cal. 242, 73 Pac. 145; Ex parte Schmitz, 150 Cal. 663, 89 Pac. 438; Matter of Ford, 160 Cal. 334, Ann. Cas. 1912D, 1267, 35 L. R. A. (N. S.) 882, 116 Pac. 757; In re Dykes, 13 Okl. 339, 74 Pac. 506; In re Dill (Kan.), 11 Pac. 672; Commonwealth v. Green, 185 Pa. 641, 40 Atl. 96, 21 Cyc. 290; Ex parte Bernson, 35 Cal. App. 344, 169 Pac. 916.
In the Matter of Ford case it is said:
“But the right to a writ of habeas corpus to determine the illegality of a detention under criminal process is not intended to apply, and may not be invoked, when the imprisonment which is made the basis of its issuance is self-invited and the surrender by the sureties is made at the instance of the petitioner, and is solely for the purpose of making a ease on the face of the petition to which the provisions of the habeas corpus act will apply.”
*196We are satisfied that the rule adopted in California and other jurisdictions, refusing parties the use of this writ, except in cases where the imprisonment is without the consent and connivance of the party seeking its use, should he enforced. We think, where the restraint is voluntary, it is not the kind of restraint that the writ of habeas corpus was intended to be used to investigate or relieve from. Where a party is at large on bail and the legality of the law under which he is being prosecuted or held may be tested, as it could have been in this case, as expeditiously in a regular trial, he should never be permitted to resort to the writ. After Weller’s conviction in the police court he could have submitted to the judgment of imprisonment and invoked the aid of the writ to test the legality of the action of the police judge in refusing him a jury trial, or he could have appealed, as he did, executed an appeal bond as provided by law, and secure his liberty pending a trial in the appellate court. But, having adopted the latter remedy, it would be trifling with the court for him to be permitted to await the day and hour of trial on appeal and then ask that the legality of his imprisonment be investigated by writ of habeas corpus by the very court in which his appeal was pending, especially where, as in this ease, his imprisonment was voluntary. For these reasons, the judgment of the lower court is reversed, and the case remanded, with directions that the petition for a writ of habeas corpus be dismissed.
CUNNINGHAM, C. ,J., and BAKER, J., concur.