after stating the case, delivered the opinion of the Court.
The attorney general makes the contention that there is no provision in the statutes permitting an appeal to this Court from ah order of the district court, or a judge thereof, in habeas corpus proceedings, and that this Court has no jurisdiction to entertain this appeal. His argument proceeds upon the theory that the certiorari proceeding was merely ancillary to the application for the writ of habeas corpus, and follows it; and that, if there is no appeal from the order denying this latter, there is therefore no jurisdiction in this Court to consider any question arising out of the action of the district judge in dismissing the former. The correctness of this contention depends upon the two propositions, viz: -Whether an appeal lies from the order denying the writ of habeas corpus; and, if it does not, whether the application for the writ of certiorari is so far independent of the former proceeding that the appeal may'be entertained from the order in so far as it denied this writ.
There is no provision in the habeas corpus act (Penal Code, Sections 2740-2772), upon the subject of appeal, nor is there any such provision in the title in the Penal Code under which this proceeding is classified. This title, Title XII., Chapter I., Part II., classifies the writ of habeas corpus as a special proceeding of a criminal nature. • Following out the idea suggested by this classification, in the absence of a right of appeal provided for in the title treating of this proceeding, we naturally and properly turn to the general provisions of the Penal Code, allowing appeals in criminal cases, to find if *50the right is provided for there. These we find in Sections 2270 — 2273, inclusive. Section 2270 provides that “an appeal to the Supreme Court may be taken by the defendant, as a matter of right, from any judgment against him.” Section 2272 allows an appeal to the defendant (1) from a final judgment of conviction; (2) from an order denying a motion for a new trial; and (3) from an order after judgment affecting the substantial rights of the party. Section 2273 enumerates the instances in which the state may appeal. Bearing in mind the rule that an appeal is a creature of the statute, and is allowable only where the order or judgment sought to be reviewed by this means is fairly covered by its terms (In re Tuohy's Estate, 23 Mont. 305, 58 Pac. 722), we must conclude that the foregoing provisions have no reference to habeas corpus proceedings, unless the order made therein can be designated as a “final judgment,” and the complainant can be properly denominated a ‘ ‘defendant. ’ ’ That this latter term is not a proper designation for a petitioner in a habeas corpus proceeding is clear from Section 2890 of the Penal Code, which provides that “the party prosecuting a special proceeding of a criminal nature is designated in this Code as the complainant, and the adversé party as the defendant. ’ A party cannot for the purpose of instituting a proceeding be the complainant, and for the purpose of prosecuting an appeal in the same proceeding shift his position to that of the defendant. Nor is the determination of a court or judge in this proceeding adverse to the complainant properly designated by the term “judgment, ’ ’ within the meaning of the foregoing provisions. Obviously, the judgment mentioned in Section 2270 is the final judgment or other order referred to in Section 2272, and embraces only those judgments and orders which become res adjudicata and final as to all matters involved in the controversy. And the rule has generally been adopted that an order denying a writ of habeas corpus is not such a judgment as to render the rights of the petitioner res adjudicata, and finally to conclude him. This was the rule at common law. (Rex v. Suddis, 1 East, 306; Church on Habeas Corpus, Sec. 386.) It is *51so held in California, Missouri, Illinois, Pennsylvania, Massachusetts, and North Dakota. (In re Perkins, 2 Cal. 424; In re Ring, 28 Cal. 247; Howe v. State, 9 Mo. 682; Hammond v. People, 32 Ill. 446; Ex parte Thompson, 93 Ill. 89; Com. ex rel. Lehman v. Jones, 3 Serg. & R. 158; Com. ex rel. Parker v. Blatt, 165 Pa. St. 213, 30 Atl. 674; Bradley v. Beetle, 153 Mass. 154, 26 N. E. 429; Carruth v. Taylor, (N. D.) 77 N. W. 617.) This was formerly the rule in New York. (People ex rel. Lawrence v. Brady, 56 N. Y. 182.) An appeal is now allowed in that state by statute. ‘ ‘In the federal courts of the United States the doctrine of res adjudicata does not apply to an order remanding the prisoner, and the prevailing doctrine in the state courts, in the absence of statutory provisions, is that a judgment remanding a prisoner on habeas corpus is not appealable or subject to review, and that the doctrine of res adjudicata has no application to such a case. The prisoner is entitled to the opinion of all the courts as to his freedom, and in his applications for the writ of habeas corpus may exhaust the entire judicial power of the state. ’ ’ (Church on Habeas Corpus, Sec. 386.)
From these considerations, it is clear that from an order denying the writ and remanding the prisoner no appeal lies, under any of the foregoing provisions of the Penal Code. It is equally clear that the appeal does not lie under any provision of the Code of Civil Procedure. Section 1722 of that Code, as amended by the Act of 1899, p. 146, provides only for appeals in civil cases, and has no application to any matter contained in the Penal Code. This is made clear by reference to Section 1720 of the Code of Civil Procedure, which provides that “a judgment or order in a civil action * * * may be reviewed as prescribed in this Title, and not otherwise.” It is further provided in Section 3480 that “the Penal Code defines and provides for the prosecution of a criminal action. ’ ’
W e must therefore hold that the appeal, so far as it seeks a review of the action of the district judge upon the application for the writ of habeas corpus, must be dismissed.
*52To support the appeal, the appellant cites Territory ex rel. McCann v. Sheriff, 6 Mont. 297, 12 Pac. 662; State ex rel. Newell v. Newell, 13 Mont. 302, 34 Pac. 28; State ex rel. Giroux v. Giroux, 15 Mont. 137, 38 Pac. 465; Id., 19 Mont. 149, 47 Pac. 798, — as conclusive. It is sufficient to say of Territory ex rel. McCann v. Sheriff, and State ex rel. Newell v. Newell that they arose under the provisions of the old Code, which were essentially different in many respects from those pontained in our present Code, and that in neither of them was the question of the right of appeal presented. This latter remark also disposes of State ex rel. Giroux v. Giroux. Though it arose under our present Code, the right of review by this Court was not called in question. Had the attention of this Court been called to the provisions of the Code as they now stand, doubtless the authority of People v. Schuster, 40 Cal. 627, would have been followed.
We are of the opinion, however, that the appeal from the order, in so far as it dismissed the certiorari proceedings, is properly before us. The relief sought thereby was the same as if the. proceeding had been instituted as an independent remedy; for its purpose was to have the district judge review the proceedings had before the justice of the peace, and to annul the order therein made, and not merely to bring up the record of those proceedings in aid of the habeas corpus.- All the substantive relief that the district judge could, under any circumstances, grant under the certiorari, was sought by the relator, and the power of the judge to act thereon was invoked to the same extent as if the habeas corpus proceeding had not been instituted. There was no appeal from the order complained of, and the only way open to the relator to have it set aside was -by means of the review allowed under this writ. (Code of Civil Procedure, Section 1941.) It is not uncommon for this writ t.d be used in this way, where it is sought to set aside a conviction in summary proceedings before a justice of the peace where there is no appeal. For this course of procedure we find sanction in the following authorities: Grieb v. Kuttner, 135 Pa. St. 281, 19 Atl. 1040; Gosline v. Place, *5332 Pa. St. 520; Bacon Abr. tit. Habeas Corpus, 133; Id. Certiorari, A; Hurd on Habeas Corpus, 355, 356; Church on Habeas Corpus, Secs. 262 — 264; State v. Glenn, 54 Md. 572; In re McCutcheon, 10 Mont. 115, 25 Pac. 97. In Grieb v. Kuttner, supra, the court, after noticing the earlier cases, proceeds: ‘In Berger v. Smull, 39 Pa. St. 302, as already-noted, there was no habeas corpus, and the result of the case is that certiorari and habeas corpus may be used separately or together; and, when used concurrently, the question which is the principal writ and which merely ancillary will depend on the facts of the particular case and the nature of the relief sought. ’ ’ The office of the habeas corpus is to bring up the body only, and the court of judge will upon the return in this proceeding judge of the illegality of the imprisonment upon the commitment.. If this be irregular merely, or it does not appear therefrom that the inferior court was without jurisdiction, the complainant will be remanded. If, however, it is the purpose of the complainant to have the proceedings before the justice reviewed, and the judgment or order therein annulled, on the ground of want or excess of jurisdiction, then certiorari may issue to the justice to bring up the record, to enable the superior court or its judge to take such action therein as may be proper. The office of the writ is thus explained in the citation from Bacon’s Abridgement, supra. (In re Bion, 59 Conn. 372, 20 Atl. 662, 11 L. R. A. 694.)
Whether, under our statute (Penal Code, Sections .2753, 2754), these remarks apply generally to habeas corpus proceedings, we do nqt decide. They are certainly pertinent and applicable to the facts of this case; for the reason that the complainant in his petition for the writ of habeas corpus does not attack the validity of the order made by the justice, or the sufficiency of the evidence upon which it was based, but assails the validity of the commitment only.
We conclude, therefore, that the application to the district judge for the writ of certiorari, though .concurrent with the application for the writ of habeas corpus, was not merely ancillary to the latter proceeding, but was an independent pro*54ceeding for substantive relief, by direct attack upon the proceedings before the justice, which, as we have said, were not assailed by the habeas corpus, seeking to overturn the order resulting therefrom. In the absence of an appeal from the action of the district judge, in so far as it disposed of this proceeding adversely to the relator, he would have been finally concluded thereby. (State ex rel. Shing v. Lenahan, 17 Mont. 518, 43 Pac. 712.)
Passing now to the consideration of the appeal on this branch of the case, we shall consider briefly the contentions of the appellant in the order in which they are made.
1. Is the order of the justice void in failing to fix a term of imprisonment ? A person who has threatened to commit an offense against the person or property of another may be required by any magistrate, upon written complaint, to be arrested, and brought before him for examination. (Penal Code, Secs. 1430-1445.) The person so arrested may controvert the charge. Thereupon the magistrate must take the proof in writing. “If it appear that there is no just reason to fear the commission of the offense alleged to have been threatened, the person complained of must be discharged. ’ ’ (Penal Code, Sec. 1434.) If, however, there is just reason to fear the commission of the offense, the person complained of may be required to enter into an undertaking in such sum, not exceeding $5,000, as the magistrate may direct, with one or more sufficient sureties, to keep the peace toward the state, and particulary toward the complainant. The undertaking is valid and binding for one year, and may, upon the renewal of the complaint, be extended for a longer period, or a new undertaking required. (Id. Sec. 1435.)
If the undertaking is given, the party complained of must be discharged. ‘ ‘If he does not give it, the magistrate must commit him to prison, specifying in the warrant the cause of commitment, the requirement to give security, the amount thereof, and the omission to give the same.” (Id. Sec. 1436.)-The statute does not provide the form of the order to be made by the magistrate; but, testing the order under consideration *55by applying to it the provisions of the sections quoted, it appears to be a literal compliance with them. It recites a finding of just cause to fear the commission of the offense charged, it.directs security to be given for one year to keep the peace toward the state, and particularly the complainant, and directs the person complained of, in default of security, to be committed to prison until the same be given. It might have been more explicit in reciting the charge upon the proof of which the undertaking was required; but we must not exact too much technical nicety from justices of the peace, who are not experienced lawyers; otherwise the law would more often exemplify the failure, rather than the accomplishment, of justice. A reference to the complaint on file containing the charge is sufficient.
Nor does the statute require the order of the justic to fix the term of imprisonment. The purpose of the statute is to prevent crime, not to punish one already committed. Therefore the imprisonment which is the result of a failure to give bond is not a penalty for the threatened crime as proved at the hearing, but the alternative provided for preventing its accomplishment, where the person charged has refused or failed to obey the order to furnish security for the public peace. The imposition of imprisonment becomes necessary only after the other alternative has failed.
2. The commitment is not properly before us. upon this appeal, but we will remark of it, in passing, that it contains all the recitals required by the statute. Upon the failure to give the undertaking, the magistrate must commit the person charged to prison, specifying in the warrant (a) the cause of commitment; (b) the requirement to give security; (c) the amount thereof; and (d) the omission to give the same. In these particulars the warrant is sufficient. (In re Miller, 1 Daly, 562; Bradstreet v. Furgeson, 23 Wend. 638; Murfree, Jurisdiction of Justices, Sec. 1133.) The statute does not require it to recite the charge nor to fix the time of imprisonment. In respect of the time, the recital that security for the peace for one year has been required as the cause of commitment is sufficient.
*563. In a proceeding of this character the person complained of is not entitled toa jury trial.' As heretofore remarked, the purpose of the proceeding is to prevent, not to punish, crime. “A binding to-goo'd behavior is not by way of punishment, but it is to show that, when one has broken the good behavior, he is not be any more trusted.” [Reg. v. Rogers, 7 Mod. 28.) Counsel in support of relator’s claim to this right, cite Section 23 of Article 111 of the Constitution, which declares that “the right of trial by jury shall be secured to all, and remain inviolate;” and also Sections 20 and 21 of Article VIII of the same instrument, providing that justices’ courts “shall have such jurisdictions in criminal matters, not of the grade of felony, as may be provided by law. ’ ’ Attention is then called to Section 68 of the Code of Civil Procedure, and Sections 1400 and 1355 of the Penal Code, defining the jurisdiction of these courts in criminal matters, and providing that “in all criminal prosecutions the aocused shall have the right to a speedy trial by an impartial jury.” Counsel contends that, in the light of the declaration of the Constitution and these statutory provisions, the right of trial by jury must be awarded to the accused in all cases of criminal cognizance by the courts of this state. In this contention, however, counsel overlooks one of the fundamental rules of constitutional construction on this subject, viz., that this instrument must be construed in view of the conditions existing at the time of its adoption, and that the right of trial by jury guaranteed under this'broad declaration is the right as it then existed, and not one created or extended, except by express terms, by the instrument itself. This rule extends to both ■civil and criminal trials, and is applied by the courts to the constitutions of all our states. (Proffatt on Jury Trial, Sec. 87; Cooley, Const. Lim. 74, 389; State v. Glenn, 54 Md. 572; Flint River Steamboat Co. v. Foster, 5 Ga. 194; Ross v. Irving, 14 Ill. 171; Anderson v. Caldwell, 91 Ind. 454; Allen v. Anderson, 57 Ind. 388; State v. McClear, 11 Nev. 39; Frazee v. Beattie, 26 S. C. 348, 2 S. E. 125; Stilwell v. Kellogg, 14 Wis. 461.) The rule is'elementary,'and so well settled *57that further comment is unnecessary. Looking into the history of our own Constitution, we find that at the date of its adoption, in 1889, while the right to a trial by jury existed by virtue of the territorial statutes in all cases of felonies and misdemeanors, it did not exist under the provisions of the statutes in force for the prevention of public offenses. Statutes the same in substance as those under which the relator was held in the present instance were enacted by our first territorial legislature in 1864, and have been upon the statute books of the territory and state ever since, as a substantial part of our police regulations. In such cases the right of trial by jury has never existed. There is nothing in the Constitution extending this right to any case in which it did not exist at the date' of its adoption. The provisions of the Codes cited by counsel touching the criminal jurisdiction of justices of the peace are substantially the same as they have been throughout the history of our system of laws, and have no reference to the proceeding in question here. They are applicable only to cases where the justice is clothed with the power to try and punish crimes actually committed.
The justice proceeded under the provisions of the statute, and his action was correct.
The judge of the district court should have entered an order affirming the proceedings of the justice. (Code of Civil Procedure, Sec. 1948.) The order of dismissal, however, was, in effect, the same, and his action will not be reversed for this technical error.
Let the judgment be affirmed.
Affirmed.