An information was filed in the District Court charging the petitioner with the crime of grand larceny. He pleaded guilty of petit larceny, the plea was accepted by the prosecuting officer and entered in the journal of the court, and he was remanded to await sentence. Upon being called up for sentence he was informed that he would be sentenced to the penitentiary, the records of the court showing that he had once before been convicted of petit larceny; whereupon he asked leave to withdraw his plea of guilty and to plead not guilty to the information. This the court refused to permit, for the reason that material witnesses against him had been *173permitted to depart and the jury for the term had been discharged. The court then proceeded to sentence him to the penitentiary for a term of two years and a half, the judgment reciting that “said James Bandy having heretofore, on June 9, 1900, been convicted of the crime of petit larceny, as will more fully appear on page 355 of this- record, therefore, James Bandy is found to be guilty of the crime of grand larceny.” Our statute, after fixing the penalty in petit larceny at imprisonment in the county'jail for not more than six months and a fine not exceeding one hundred dollars, prescribes that “upon a second conviction of petit larceny in this State, the person convicted shall suffer the punishment prescribed for those convicted of grand larceny.” (R. S., Sec. 4985-)
Two questions are presented in this case: First, did the court err in sentencing the defendant to the penitentiary upon his plea of guilty of petit larceny, and, second, conceding that the judgment was erroneous, is the defendant entitled to be discharged upon habeas corpus ?
It would seem to be beyond controversy that there is nothing to support the finding of the court that the defendant was guilty of grand larceny. He was not tried upon that charge either by a jury or the court, and his plea was guilty-of petit larceny only, which, when accepted by the court, operated as an acquittal of the charge of grand larceny upon the same facts. And the statute does not purport that the second offense of stealing property of less value than twenty-five dollars shall constitute grand larceny. The provision relied upon merely "designates the punishment by reference to the punishment for grand larceny. It .might designate the punishment fdr'ári aggravated-assault, or any other offense," in the same way. It- is plain, therefore, that the finding is entirely unsupported.
This view of the matter, however, is to some extent technical and formal, and it may, perhaps, be reasonably maintained that the mere misnaming of the offense will not vitiate the judgment, if it is otherwise legal and valid.
*174But we think that, in reason and by the great weight of authority, as the fact of a former conviction enters into the offense to the extent of aggravating it and increasing the punishment, it must be alleged in the information and proved like any other material fact, if it is sought to impose the greater penalty. The statute makes the prior conviction a part of the description and character of the offense intended to be punished. (Tuttle v. Com., 2 Gray (Mass.), 505; Clark’s Crim. Proc., 204.) In this case the information did not charge the larceny as a second offense, no proof was offered identifying the petitioner as the person shown by the record to have been formerly convicted, his plea of guilty was not to the charge of the larceny as a second offense, and he was denied any opportunity to plead to or defend against such charge. We are clearly of the opinion that the judgment was erroneous and could not be sustained upon a proceeding in error.
The second question, whether the petitioner is entitled to be discharged upon habeas corpus proceedings, presents greater difficulty. Jurisdictional facts alone are to be considered. If the court had jurisdiction of the person and of the subject matter, and to render the particular judgment in question, the inquiry is at an end and, however erroneous the judgment may be, the applicant will be remanded into custody. If, upon the other hand, the court had jurisdiction of the person and of the subject matter, but was without jurisdiction, to render the particular judgment, then, such judgment is void — is, in effect, no judgment at all, and the applicant must be discharged. This proposition was carefully considered by this court in Miskimmins v. Shaver, 8 Wyo., 392, and we think is well settled by the later and best considered decisions. But the distinctions between judgments which are simply erroneous and voidable and those which are absolutely void are often so narrow that it is not easy to apply them in particular cases.
The view that the action of the court in this case was mere error and not in excess of its jurisdiction is very strongly *175and ingeniously argued by the counsel for the State. The argument is in substance: That the court, without question,' had jurisdiction of the crime of petit larceny as a second-offense. It also had jurisdiction to punish by imprisonment in the penitentiary for that offense. It was true and was’ proven to the satisfaction of the court that the defendant was guilty, and that it was the second offense, and the applicant is, therefore, suffering only the legal and' appropriate sentence for his crime; that the method by which the court' determined the fact that it was the second offense was merely an error in the procedure and did not affect its jurisdiction; that, therefore, the judgment is erroneous, but not void.
The argument is ingenious and, as before remarked, the distinctions between judgments which are merely erroneous and voidable and those which are void, are often somewhat elusive. But we are disposed to think the argument proves too much. By the same reasoning, if a prisoner were indicted for petit larceny and it was proven upon the trial, or otherwise came to the knowledge of the court, that the larceny was from the person and by violence, he might be found guilty of robbery and sentenced to the penitentiary for fourteen years, while the maximum penalty for the offense to which the prisoner was called upon to answer was but six months in jail and a hundred dollars’ fine. The cases seem to be parallel, and yet, in the latter, it would not be contended that there was a mere error of procedure; very clearly the court would be without jurisdiction to render such judgment, for the reason that its effect is to sentence the prisoner for a crime for which he has not been indicted, upon a charge for which he has not been tried and to which he has had no opportunity to plead, thus denying him his constitutional right-to demand the nature and cause of the accusation against him and to have a trial by jury. He is deprived of his liberty without due process of law. And when any constitutional right or immunity of a person is violated, the judgment of the court is void. (Brown on Jurisdiction, Sec. 97.)
In a case in Nevada the petitioner was indictéd- for the *176crime of murder, alleged to have been committed in the perpetration of the crime of rape. By the verdict of the jury he was convicted of the crime of rape and the court sentenced him to twenty years’ imprisonment. He was discharged upon habeas corpus, and the Supreme Court, in concluding their opinion, say: “Believing the judgment in this case to be void because the court had no jurisdiction of the subject matter (that, is, of the crime for which he was convicted), for the reason that the defendant was neither indicted nor tried for the crime of rape, and that the execution of the judgment deprives the petitioner of his liberty without due process of law, the commitment issued on said judgment does not justify his further detention, and he will accordingly be discharged.” (Ex parte Dela, 60 Pac., 217.) The reason here is stronger than in the Nevada case in the respect that the judgment imposes a greater punishment than the maximum authorized by law for the crime of which the defendant pleaded guilty. And it is to be observed also that it is not a case either in which the court has simply exceeded its jurisdiction by sentencing the applicant to a longer term than that authorized by law. But it imposed an infamous punishment, entirely unauthorized by law, for the offense to which he pleaded guilty. It was as completely without jurisdiction to make the order as if it had sentenced him to be hanged.
In Ex parte Lange, 18 Wall., 176, Mr. Justice Miller, in discussing this subject, says: “It was error, but it was error because the power to render any further judgment did not exist. It. is no answer to this to say that the court had jurisdiction of the person of the prisoner, and of the offense under the statute. It by no means follows that these two facts make valid, however erroneous it may be, any judgment the court may render in such case. If a justice of the peace, having jurisdiction to fine for a misdemeanor, and with the party charged properly before him, should render a judgment that he be hung, it would simply be void. Why void? Because he had no power to render such a judgment, *177s.o if a court of general jurisdiction should, on an indictment for libel, render a judgment of death, or confiscation of property, it would, for the same reason, be void.”
Counsel contend that the judgment was not a conviction of grand larceny, but of petit larceny as a second offense. We think the record shows that the petitioner was found' guilty of grand larceny and sentenced as for that offense, the court apparently adopting the view that petit larceny as a second offense constituted the crime of grand larceny under the statute. But we are unable to perceive that the form of the judgment, in that particular, affects the questions involved in any substantial way; nor does the fact that the information charged grand larceny. The petitioner did not plead guilty either to grand larceny or to petit larceny as a second offense, and he was not tried or, in any lawful way, found guilty upon either charge.
For the reasons stated, we are of the opinion that the judgment is void and that the petitioner must be discharged.
Potter, C. J., and Knight, J., concur.