Henderson, J.:
Tbe case, as stated in tbe petition, is that tbe petitioner was on tbe thirteenth day of April, 1888, twice indicted by tbe grand jury of tbe third district court; that both indictments were found and presented at tbe same time; that tbe names indorsed on each, as witnesses, were tbe same; that one charged him with the crime of adultery, alleged to have been committed with one Mary Busley; that tbe other charged him with tbe crime of unlawful cohabitation, alleged to have been committed by living with Mary Barton and Mary Busley as bis wives; that tbe indictment for adultery alleged tbe crime to have been committed within tbe period of time covered by . tbe indictment for unlawful cohabitation; that on tbe sixth day of February, 1889, tbe petitioner was arraigned before tbe court on tbe charge of unlawful cohabitation, and pleaded guilty; that thereupon tbe court suspended sentence upon that charge; that immediately thereafter be was arraigned upon tbe charge of adultery, and pleaded guilty, and thereupon be was sentenced by tbe court to imprisonment in tbe penitentiary. Thereupon tbe petition avers that the *265Mary Busley named in the two indictments is one and tbe same person. The petition alleges that the imprisonment is illegal and void, in this: “That the court had no jurisdiction to pass judgment against your petitioner on the indictment for adultery, for the reason that the offense charged is the same as that contained and set out in the other indictment and record* for unlawful cohabitation; that the prosecution and conviction for unlawful cohabitation. barred any further prosecution or proceedings; and that the court had no jurisdiction or power to take any action upon the indictment for adultery.” The petition concludes with a prayer that a writ of habeas corpus issue, to the end that he be discharged from imprisonment. The district attorney has appeared upon this application, and denies the petitioner’s right to the writ.
It will readily be seen from the foregoing statement that the petitioner was regularly indicted, convicted, and sentenced for the crime of adultery, and that there is no illegality appearing upon the record thereof; but that the petitioner is seeking to impeach or destroy this record by alleging and showing the existence of another, made in another case, and which is entirely separate and distinct, and which, if the facts set out in his petition are true, might have constituted a good defense to the charge of adultery if interposed by plea of former conviction in the trial court; and the question presented to us is whether the defense of a former conviction, upon a prior prosecution, can be made available for 'the first time on an application for a writ of habeas corpios in this court, after conviction on plea of guilty, without pleading it, or in any way calling it to the attention of the trial court. The Code of Criminal Procedure of this territory provides as follows: “Sec. 201. There are four kinds of pleas to an indictment: A plea of (1) guilty; (2) not guilty; (3) a former judgment of conviction or acquittal of the offense charged, which may be pleaded either with or without the plea of not guilty; (4) once in jeodardy.” Section 202 prescribes the form of each of these pleas. “Sec. 205. All matters of fact tending to establish a defense, other than that specified in the third subdivision of section 201, *266may be given in evidence under tbe plea of not guilty.” “ Sec. 216. An issue of fact arises (1) upon a plea of not guilty; (2) upon a plea of former conviction or acquittal of tbe same offense; (3) upon a plea of once in jeopardy. Sec. 217. Issues of fact must be tried by a jury, unless a trial by jury be waived in criminal cases, not amounting to a felony, by the consent of both parties expressed in open court, and entered in its minutes.” 2 Comp. Laws, 1888, pp. 697-700. These provisions substantially follow the common law. The plea of former conviction raises an issue of fact, and is for trial by jury. Archb. Crim. PL & Pr., 348, note 1. The petitioner relies upon the case of Ex parte Snow, 120 U. S., 274, 7 Sup. Ct. Rep., 556, and Ex Parte Nielsen, 131 U. S., 177. In the Nielsen case, Nielsen had been convicted of unlawful cohabitation, and sentenced to the penitentiary. After his term of imprisonment had expired, he was again prosecuted upon a charge of adultery alleged to have been committed within the period covered by the charge of unlawful cohabitation, and with one of the same women with whom he was charged to have unlawfully cohabited. To the charge of adultery he pleaded the former conviction, setting up the record fully, and averring the identity of the two charges. To this plea the government demurred. The demurrer was sustained by the court, and he was put upon trial on his plea of not guilty before the jury, and was convicted and sentenced. The supreme court of the United States held that the charge of adultery was included in the charge of unlawful cohabitation, and that the demurrer to his plea of former conviction was improperly sustained, and that he should be discharged. His former conviction was a part of the record of his conviction for adultery. He had pleaded it. The demurrer to his plea admitted its truth, the same as though it had been found by the verdict of a jury. A fact had then been established which cleared him of the charge, and the court had no jurisdiction to proceed further; but nevertheless he was put upon a trial of his plea of not guilty, and convicted and sentenced. All this appeared in the record of his conviction. In the Snow case, supra, the record was the same.
*267The petitioner claims that the court had no jurisdiction over the offense of adultery charged against him, because, as be avers, be bad been convicted of the same identical offense before; and be cites the Constitution of the United States to the effect that no person shall be twice put in jeopardjA The courts, however, are the properly constituted tribunals to determine the question as to whether a party has once been in jeopardy, and the district court in which the petitioner was convicted had jurisdiction to determine that question. It is equally clear that courts have no jurisdiction to imprison a person unless he has committed some crime, but they have jurisdiction to determine the fact as to whether the crime has been committed, and to proceed with that inquiry until it is determined. If it is found that no crime has been committed, the jurisdiction of the court ceases; but, if it has been, then the court has jurisdiction to inflict the punishment. Church, Hab. Corp., §§ 223, 336; In re Bogart, 2 Sawy., 396. When a person is charged with a crime before a court having jurisdiction to determine his guilt or innocence, and he claims immunity by reason of a former conviction or acquittal, the burden is upon him to plead it in answer to the charge and to establish it by his evidence, and if he does not do so it is waived. 1 Bish. Crim. Proc., § 806; 1 Whart. Crim. Law, § 538, et seq.; Ex parte Kaufman, 73 Mo., 588; In re Bogart, 2 Sawy., 396; State v. Webb, 70 Mo., 333. The question of a former conviction was a matter of defense, and was a qxrestion for the determination of the court having jurisdiction to try the charge. It involves an issue of fact; the identity of the offenses charged; the existence and priority of the record relied upon; and on habeas corpus this court cannot try such an issue. In re Bogart, supra; State v. Webb, supra; Church, Hab. Corp., § 366.
It is also claimed that the judgment was void, because it was passed in less than six hours after the plea of guilty was entered, and was therefore in violation of the statute. The copy of the record attached to the petition shows that the petitioner was arraigned, and pleaded guilty, and “ requests that sentence be now passed upon him ” on the same day sentence was imposed. The plea and sentence *268are separate entries on tbe journal. It is claimed that this shows that less than six hours intervened between the plea and sentence. We do not think that this is a necessary inference; but if it was, it would be but a mere irregularity, which could not be reviewed cm habeas corpus. Hurd. Hab. Corp., 331, et seq.; Ex parte Smith, 2 Nev., 338. An order should be entered denying the application.
Zane, C. J., and Judd, J., and Andebhon, J., concurred.