This is a proceeding in habeas corpus. The petitioner is confined in the State Prison at Folsom under a judgment of conviction on his plea of guilty of the crime of burglary of the first degree and an adjudication that he is an habitual criminal by virtue of his admission of two prior convictions of a felony. The basis for his application for release *296from custody is his claim that one of the prior convictions did not constitute a felony for which he could be adjudged an habitual criminal and that his sentence is therefore excessive and void.
The petitioner was accused by information of the crime of burglary committed on March 10, 1938, in the city of Los Angeles. The information also alleged two prior convictions of felonies for which the petitioner had served terms. One was in the circuit court of Josephine County, Oregon, on December 9, 1932, which the information specified as a prior conviction of “Burglary, a felony.” The petitioner pleaded guilty to the main charge, and admitted the prior convictions. The court found the burglary to be of the first degree, and also found that the petitioner was not armed with a deadly weapon at the time of the commission of the crime. He was adjudged to be an habitual criminal. (Pen. Code, § 644.) Judgment was entered accordingly and the petitioner was received at Folsom on June 1, 1938.
The problem is immediately presented as to the scope of the hearing and determination in this proceeding in view of the record of the trial in which petitioner was adjudged an habitual criminal.
In the determination of a proceeding in habeas corpus in this state the court is ordinarily concerned with an inquiry into the jurisdiction of the court in which the prisoner was convicted. It is the general rule that the writ may not be used to correct error nor be employed where there is a remedy by appeal or other direct attack. But in exceptional cases it may be issued even though other remedies might have been available. (In re Belt, 159 U.S. 95, 100 [15 S.Ct. 987, 40 L.Ed. 88] ; In re Bell, 19 Cal.2d 488 [122 P.2d 22] ; In re Connor, 16 Cal.2d 701, 705, 712 [108 P.2d 10].)
In In re Bell, supra, at page 494, this court said: ‘ ‘ There are other situations in which habeas corpus is used, not as a test of jurisdiction, but to review a question of law that cannot otherwise be raised or is so important as to render the ordinary procedure inadequate. Thus, it lies to test whether there is probable cause to justify the committing magistrate in holding petitioner for trial. . . . There is no other method of securing a review of the magistrate’s determination in this regard. ... It also lies to test whether the complaint charges a public offense . . . even though this question falls within the jurisdiction of the trial court and may be raised on ap*297peal. Certain, courts go so far as to permit the use of habeas corpus before trial when the statute of limitations has run upon the offense charged. ...” In that case it was also held that it was not necessary to exhaust all available remedies by appeal before habeas corpus could be invoked to test the question of constitutionality.
In the present case, in view of the record, there were no apparent grounds of appeal and an appeal would not have disclosed the alleged unlawful term of imprisonment of the petitioner. Furthermore, by section 1025 of the Penal Code, the defendant’s admission that he has suffered the alleged prior convictions, unless withdrawn by consent of the court, is made conclusive of the fact of his having suffered such previous convictions “in all subsequent proceedings.” But the words “subsequent proceedings” refer to proceedings in the same action, including an appeal from the judgment of conviction. That they do not include an independent proceeding in habeas corpus is indicated by the fact that the courts in numerous cases hereinafter cited have entertained the inquiry regardless of the fact that the defendant had admitted the prior convictions.
The Legislature has provided by section 1484 of the Penal Code that a petitioner in a habeas corpus proceeding may “allege any fact to show either that his imprisonment or detention is unlawful, or that he is entitled to his discharge. The court or judge must thereupon proceed in a summary way to hear such proof as may be produced against such imprisonment or detention, or in favor of the same, and to dispose of such party as the justice of the case may require. . . .” In the Bell case, supra (19 Cal.2d at p. 501 et seq.), following In re Connor, 15 Cal. 2d 161, 164 [99 P.2d 248], and other cases, and applying the foregoing provisions of the Penal Code, the court rejected the “all too broad” statement that the inquiry on habeas corpus is limited to an investigation on the face of the proceedings in the trial court. The established rule in this state was reiterated to the effect that in a habeas corpus proceeding the court may look beyond the face of the record. In In re Connor, supra (16 Cal.2d at p. 712), it was said that the scope of inquiry on habeas corpus in this state may, under exceptional circumstances, extend over the entire course of proceedings in the lower courts and may include additional evidence taken in the court entertaining the proceeding either directly or under an order of refer*298ence. The inquiry extends not only to the power of the trial court to hear and determine the subject matter, but also to its authority to act in a particular manner over the person of the accused. (Fortenbury v. Superior Court, 16 Cal.2d 405 [106 P.2d 411].) In the latter case it was pointed out that such a course does not imply an abandonment of fundamental legal principles, but, on the contrary, that it necessarily flows from constitutional requirements and long established rules.
The courts have refused to recognize the remedy by writ of error coram nobis as appropriate for an inquiry into an asserted imposition of an excessive sentence. That writ has been denied as an alternative where the remedy by appeal existed. (People v. Lumbley, 8 Cal.2d 752 [68 P.2d 354]; People v. McVicker, 37 Cal.App.2d 470 [99 P.2d 1110] ; People v. McConnell, 20 Cal.App.2d 196 [66 P.2d 720] ; People v. Moore, 9 Cal.App.2d 251 [49 P.2d 615].) In People v. Lumbley, at page 755, and People v. McVicker, at page 475, it was indicated that habeas corpus is the proper proceeding to test the question whether the petitioner was serving an excessive sentence by virtue of an unauthorized adjudication that he was an habitual criminal. The respondent fails to cite a case, and we have discovered none, in which the court has refused to examine into the petitioner’s claim that the trial court exceeded its power by imposing an excessive sentence, when that claim was presented in a habeas corpus proceeding. Courts have inquired into the merits of such a claim in habeas corpus even where the question might have been determined on an appeal from the judgment of conviction. (See In re Gilliam, 26 Cal.2d 860 [161 P.2d 793]; In re Brady, 5 Cal.2d 224 [53 P.2d 945]; In re Morck, 180 Cal. 384 [181 P. 657] ; In re Howard, 69 Cal.App.2d 164 [158 P.2d 408] ; In re Connell, 68 Cal.App.2d 360 [156 P.2d 483] ; In re Taylor, 64 Cal.App.2d 47 [148 P.2d 143] ; In re Bertrand, 61 Cal.App.2d 183 [142 P.2d 351] ; People v. McVicker, supra, 37 Cal.App.2d 470, 474-475; In re Tartar, 1 Cal.App.2d 400 [36 P.2d 419] ; In re Miller, 133 Cal.App. 228 [23 P.2d 1034] ; In re Bouchard, 38 Cal.App. 441 [176 P. 692].) As more directly intimated in the Bell ease, supra (19 Cal. 2d 488, at p. 503-504), that inquiry is not only justified, but is made imperative by the provisions of section 1484 of the Penal Code which gives the court broad powers on the investigation of the legality of the restraint under which a *299prisoner is held, and precludes the court from refusing to dispose of the prisoner’s rights as the justice of the case may require and particularly when it appears that the sentence for which he could lawfully be held is less than that actually imposed upon him. The most recent pronouncement of this court is contained in the opinion in In re McVickers, ante, p. 264 [176 P.2d 40], this day filed, the reasoning and conclusions of which are in harmony with those expressed herein. In that case it was held that an adjudication of habitual criminal status is not a judgment of conviction but is, in effect, only an ancillary and severable determination of a fact pertinent to the length of imprisonment and right to parole, and hence that such determination is not necessarily characterized by the high degree of finality of a judgment of conviction. It was also held in that case that it is not the crime which a defendant may have committed in a sister state, but the crime of which he has been convicted therein, that determines his status under sections 644 and 668 of the Penal Code. The adjudicated elements of the offense must meet the requirements of the California law. It follows from that case and other pertinent eases therein and herein cited that a petitioner may attack and secure relief in habeas corpus from an erroneous adjudication of habitual criminal status where the facts appearing, either from the face of the record or by satisfactory proof, show that as a matter of law the prior conviction is of a crime which does not meet the definition of an offense included in said section 644. We conclude that the court in this proceeding should inquire into the facts presented in arriving at a determination of the question whether the petitioner is being held under an excessive sentence, and therefore is, to that extent, illegally restrained of his liberty. But the petitioner must meet the burden of overcoming the presumption of regularity which attaches to the judgment of the trial court, by proof of facts sufficient to show that the sentence imposed upon him was unauthorized and excessive. (In re Bell, supra, 19 Cal.2d 488, at p. 500; In re Taylor, supra, 64 Cal.App.2d 47, at p. 51.)
The court derives its power to adjudge a defendant an habitual criminal from the provisions of section 644 of the Penal Code. At the time of the petitioner’s conviction that section included, among others, the crimes of robbery, burglary, and grand theft, two convictions of which, together with time served therefor, would subject an accused to an adjudi*300cation that he is an habitual criminal and to the increased punishment for the subsequent commission of a felony. Section 668 of the Penal Code brings within the purview of section 644 convictions in other states for crimes which, if committed within this state, would be punishable as felonies under the laws of this state. In People v. Dawson, 210 Cal. 366, 372 [292 P. 267], it was stated that in order to establish the prior conviction of a felony, the statutory requirements must be fulfilled. The prior convictions must be of felonies enumerated in section 644, or substantially identical thereto, in order to effect the purposes of that section. (In re Howard, supra, 69 Cal.App.2d 164; In re Connell, supra, 68 Cal.App.2d 360; In re Taylor, supra, 64 Cal.App.2d 47, 50; People v. McChesney, 39 Cal.App.2d 36, 41 [102 P.2d 455] ; People v. Lohr, 28 Cal.App.2d 397 [82 P.2d 615]; People v. Morrison, 26 Cal.App.2d 616 [80 P.2d 94]; People v. McGee, 24 Cal.App.2d 391 [75 P.2d 533] ; People v. Shaw, 137 Cal.App. 533 [30 P.2d 1031].)
In the Lohr case, supra (28 Cal.App.2d at p. 399), on appeal from a judgment of conviction it was said: “In order to adjudge a defendant an habitual criminal the test is not whether he shall have been twice convicted of any felonies, but whether he shall have been twice convicted of felonies enumerated in section 644 of the Penal Code.” There the defendant admitted the prior convictions. In the Connell case, supra (68 Cal.App.2d 360), the defendant pleaded guilty to the main charge and admitted two prior convictions. He was adjudged an habitual criminal and sentenced to life imprisonment. On habeas corpus he was discharged when investigation revealed that one of the prior convictions was of a crime in another state which was not within the purview of section 644, and that the petitioner had served, with the benefit of credits, the maximum term for which he should have been imprisoned on conviction of the main charge. In the Howard case, supra (69 Cal.App.2d 164), a habeas corpus proceeding, the petitioner had been charged with prior convictions of two felonies, one in the State of New Mexico, which he admitted. He was adjudged an habitual criminal under section 644. It was conceded that the New Mexico conviction was for the theft of an overcoat and lumber jacket of the value of $45 and that this was not such a crime as would constitute a felony in this state or which was included within section 644 of the Penal Code. It was held that the trial court *301should not have considered the New Mexico conviction as bringing the petitioner within the provisions of section 644. The petitioner was released upon a showing that he had served the maximum term for which he should have been imprisoned.
The question then is whether the crime of which the petitioner was convicted in Oregon is one upon which he could be adjudged an habitual criminal under section 644 of the Penal Code.
It appears from the record before us that on October 21, 1932, the petitioner was arrested and held in jail at Grants Pass, Oregon, on a tentative charge of burglary in violation of section 14-309, Oregon Code. Official investigation disclosed that the entry of the building involved had not been with an intent to steal or commit a felony." The charge of burglary was accordingly withdrawn and in its place there was substituted the charge of Larceny in a Building, a violation of section 14-316, Oregon Code. The petitioner pleaded guilty to that charge in the Oregon court. He and two others also accused were found to have entered a Standard' Oil Company warehouse and carried away thirty gallons of gasoline. He was sentenced and was confined in the penitentiary at Salem, Oregon, for an indeterminate period not to exceed eighteen months.
Larceny in a Building is defined by section 14-316 of the Oregon Code as follows: “If any person shall commit the crime of larceny in any dwelling house, ... or warehouse, ... or shall break and enter in the night or daytime any church, ... or other building erected or used for public uses, and commit the crime of larceny therein, such person, upon conviction thereof, shall be punished by imprisonment in the penitentiary not less than one year nor more than seven years. ’ ’
The crime, as so defined, is not expressly included in section 644 of the Penal Code. Furthermore, the larceny of thirty gallons of gasoline, being goods of a value less than $200, is not comparable to grand theft in this state (Pen. Code, §487), nor is it robbery (Pen. Code, § 211). The respondent does not question that the conviction of Larceny in a Building'is the prior conviction referred to in the information here involved. He contends, however, that the Oregon crime of Larceny in a Building is substantially identical to the crime of burglary which is defined in section 459 of the Penal Code *302as the entry of any house, warehouse, etc., with intent to commit grand or petit larceny or any felony. It is conceded that intent to steal or- commit a felony, a necessary ingredient of the crime of burglary in this state, is not included in the definition of Larceny in a Building under the Oregon statute, but it is argued that it may be assumed to have been present by the act of “entering” the building. One difficulty with.the respondent’s position is that the uncontroverted showing in this proceeding is contrary to the assumption. The Oregon law (Oregon Code, § 14-311) defines burglary (other than in a dwelling house) as the breaking into and entering any “other structure or erection in which any property is kept, with intent to steal therein,.or to commit any felony therein.” The punishment prescribed is “imprisonment in the penitentiary not less than two nor more .than five years.” Thus Oregon has a burglary statute containing a definition of burglary comparable to that in our Penal Code. But as stated, befóte judgment in Oregon the official investigation of the petitioner’s conduct disclosed that there had been no violation of the burglary statute. On the showing in this proceeding it is clear that intent to steal or commit a felony was not inherent in the crime with which the petitioner was charged’ and of which he was convicted in Oregon. The intent in fact was not present. The crime of Larceny in a Building, as defined by the Oregon Code and as found by the court in Oregon to have been committed by the petitioner, is not a crime which would have been punishable as a felony in this state and is not comparable to any felony mentioned in section 644 of the Penal Code. The conviction of that crime was therefore not a legal basis for an adjudication that the petitioner was an habitual criminal. It follows that an excessive sentence was imposed upon the petitioner.
The petitioner has met the burden of showing that the sentence imposed on him was unauthorized in part and excessive ; but -it does not follow that he is entitled to his discharge. The rule is settled in this state in accord with the weight of authority that “where a court has jurisdiction of the person and of,the crime, the imposition of a sentence in excess of what the law permits does not render the legal or authorized portion of the sentence void, but leaves only such portion of the sentence as may be in excess open to question and attack. In other words, the sentence is legal in so far as it is within the provisions of law and the jurisdiction of the *303court over the person and offense, and only void as to the excess when such excess is separate and may be dealt with without disturbing the valid portion of the sentence.” (12 R.C.L. p. 1208.) The rule is recognized and applied in In re Morck, supra (180 Cal. 384), In re Howard, supra (69 Cal. App.2d 164), and in other cases above cited. The rule in this state is also in accord with the text in 12 Ruling Case Law at page 1209 that, “Prior to the expiration of that part of the sentence that the court could legally impose, the prisoner will not, according to the prevailing rule, be discharged on habeas corpus, on the ground that the sentence is excessive.” (In re Rosenerantz, 211 Cal. 749, 752 [297 P. 15] ; 205 Cal. 534, 541 [271 P. 902] ; In re Spaulding, 8 Cal.App.2d 497 [48 P.2d 133]; In re Miller, supra, 133 Cal.App. 228.) No difficulty is likely to arise in ascertaining the lawful portion of the sentence which should have been imposed upon the petitioner. Section 461 of the Penal Code fixes the punishment for first degree burglary as imprisonment in the state prison for not less than five years. Since no maximum is there prescribed the petitioner has failed to show that he is entitled to his release at this time. The proper course to pursue is for the constituted authority to refix the sentence of the petitioner in accordance with the declaration of his rights as stated in this opinion.
The writ is discharged and the petitioner is remanded.
Gibson, C. J., Carter, J., and Schauer, J., concurred.