
417 P.2d 148 (1966)
The STATE of Nevada, ex rel. James Howard ORSBORN, Petitioner,
v.
Jack FOGLIANI, Warden, Nevada State Prison, Respondent.
No. 5121.
Supreme Court of Nevada.
August 4, 1966.
Gary A. Sheerin, Carson City, for petitioner.
Harvey Dickerson, Attorney General, William J. Raggio, District Attorney, and Herbert F. Ahlswede, Deputy District Attorney, Washoe County, for respondent.


*149 OPINION
ZENOFF, District Judge.
On May 14, 1965, petitioner, James Howard Orsborn, entered a plea of guilty to an information filed in the Second Judicial District Court charging him with commission of a felony, i.e., ex-felon in possession of a firearm, in violation of NRS 202.360.[1] Orsborn was sentenced to the Nevada State Prison for not less than one nor more than five years.
After serving several months in prison, Orsborn learned that the felony, upon which his Nevada conviction was based, was not in fact a felony but a misdemeanor and that, therefore, he could not have been an ex-felon at the time of the Nevada proceeding. The State, in charging the felony originally, based its case upon a conviction for attempted burglary in the State of California which, under California law, can be either a misdemeanor or felony, depending upon the sentence pronounced by the trial judge.[2] Petitioner had been sentenced in California to a term of one year in the county jail after he had violated probation. The court, by this sentence, made the conviction a misdemeanor.
At the time of the Nevada hearing, neither the petitioner, the prosecutor, the petitioner's attorney, nor the court was aware of the fact that petitioner had been convicted of a misdemeanor and not a felony in California. As a result, the district court pronounced judgment and sentenced petitioner as an ex-felon in possession of a firearm.
The State concedes that petitioner cannot be classified as an ex-felon and, therefore, was erroneously convicted and sentenced. There is not presented a fact question for resolution. All agree that the petitioner is not guilty of the offense to which he mistakenly pleaded guilty. However, the State does challenge the availability of the writ of habeas corpus.
1. NRS 34.360. "Every person unlawfully committed, detained, confined or restrained of his liberty, under any pretense whatever, may prosecute a writ of habeas corpus to inquire into the cause of such imprisonment or restraint."
The test of the availability of the writ of habeas corpus is no longer confined to one of jurisdiction, but has been expanded to allow the presentation of questions of law that cannot otherwise be reviewed, or that are so important as to render ordinary procedure inadequate and justify the extraordinary remedy. Garnick v. Miller, 81 Nev. 372, 403 P.2d 850 (1965); Shum v. Fogliani, 82 Nev. ___, 413 P.2d 495 (1966); Dean v. Fogliani, 81 Nev. 541, 407 P.2d 580 (1965); Ex parte Philipie, 82 Nev. ___, 414 P.2d 949 (1966). (See also, Ex parte Bell, 19 Cal.2d 488, 122 P.2d 22 (1942) and Ex parte Byrnes, 26 Cal.2d 824, 161 P.2d 376 (1945).)
Our statute governing the availability of the writ of habeas corpus was borrowed verbatim from California. In the Matter of Sullivan, 65 Nev. 128, 189 P.2d 338 (1948); In the Matter of Fitzgerald, 65 Nev. 157, 189 P.2d 352 (1948). The California courts have used the writ to reach such matters as an adjudication of habitual criminality, Ex parte McVickers, 29 Cal.2d 264, 176 P.2d 40 (1946); Ex parte Seeley, 29 Cal.2d 294, 176 P.2d 24 (1946); Ex parte Rosencrantz, 211 Cal. 749, 297 P. 15 (1931); a prisoner's right to apply for relief from default in perfecting an appeal, In re Martin, 23 Cal. Rptr. 167, 373 P.2d 103 (1962); the erroneous imposition of an excessive sentence, Ex parte Morck, 180 Cal. 384, 181 P. 657 (1919); the improper rendition of multiple sentences, Neal v. State, 9 Cal. Rptr. 607, 357 P.2d 839 (1960); an erroneous conviction under an inapplicable statute, In re Zerbe, 36 Cal. Rptr. 286, 388 P.2d 182 (1964); and an incorrect conviction under a complaint not charging a public offense, In re Allen, 27 Cal. Rptr. 168, 377 P.2d 280 (1962).
More recently, a California court granted the writ to a petitioner who was seeking to have a judgment and commitment declared void and the sentence set aside. In re Perez, 48 Cal. Rptr. 809 (1966). Petitioner was improperly charged with and sentenced for the crime of escape while serving a sentence for a felony, rather than properly charging him with escape while serving a sentence for a misdemeanor. The petitioner pleaded guilty and the time for filing notice of appeal had elapsed after the error was discovered. The California court held that "a defendant is entitled to habeas corpus if there is no material dispute as to the facts relating to his conviction and if it appears that the statute under which he was convicted did not prohibit his conduct." Id., at 811.
This Court has repeatedly held that a person should be discharged via the writ of habeas corpus where it is clear and undisputed that he is held by reason of the commission of an act which the law does not prohibit or penalize. Eureka Bank Cases, 35 Nev. 80, 126 P. 655, 129 P. 308 (1912); In the Matter of Kuhns, 36 Nev. 487, 137 P. 83 (1913); Ex parte Roberson, 38 Nev. 326, 149 P. 182 (1915); Ex parte La Vere, 39 Nev. 214, 156 P. 446 (1916); Ex parte Twyeffort, 42 Nev. 259, 174 P. 431 (1918); *150 Ex parte Stearns, 68 Nev. 155, 227 P.2d 971 (1951); Colton v. Leypoldt, 72 Nev. 83, 295 P.2d 383 (1956); Ex parte Rowland and Schuman, 74 Nev. 215, 326 P.2d 1102 (1958); Ex parte Hutchinson, 76 Nev. 478, 357 P.2d 589 (1960).
In the case before us, petitioner was wrongfully imprisoned. He was convicted under a statute which did not prohibit his behavior and no crime was committed. There is no dispute as to these facts. Therefore, petitioner is entitled, through the medium of habeas corpus, to his immediate release.[3]
Counsel for petitioner, having competently performed his duty in representing the petitioner, may file a certificate in accordance with NRS 7.260(3) and be allowed an attorney's fee in the amount of $250.
Petition for habeas corpus is granted.
THOMPSON and COLLINS, JJ., concur.
NOTES
[1]  NRS 202.360(2). "After July 1, 1925, no unnaturalized foreign-born person, and no person who has been convicted of a felony in the State of Nevada, or in any one of the states of the United States of America, or in any political subdivision thereof, or of a felony in violation of the laws of the United States of America, shall own or have in his possession or under his custody or control any pistol, revolver or other firearm capable of being concealed upon the person."
[2]  Section 17 of the California Penal Code reads: "A felony is a crime which is punishable with death or by imprisonment in the state prison. Every other crime is a misdemeanor. When a crime, punishable by imprisonment in the state prison, is also punishable by fine or imprisonment in a county jail, in the discretion of the court, it shall be deemed a misdemeanor for all purposes after a judgment other than imprisonment in the state prison, unless the court commits the defendant to the California Youth Authority. * * *"
[3]  This court at the time of hearing released Orsborn from custody.
