Relator, hereinafter called plaintiff, filed a petition in the district court for Lancaster County against respondent, hereinafter called defendant, alleging that plaintiff was unlawfully deprived of his liberty and praying for a writ of habeas corpus and discharge from unlawful imprisonment, namely, solitary confinement in the Nebraska State Penitentiary.
Plaintiff’s petition alleged in substance that on December 7, 1944, the district court for Douglas County sentenced and committed him to the Nebraska State Penitentiary for a period of 10 years from that date at hard labor, for the crime of robbery aggravated by habitual criminality. A certified copy of the judgment upon the verdict of guilty by a jury, sentence, and order of commitment was attached to the petition and made a part thereof. The validity thereof was not attacked or denied in any manner by plaintiff, but he alleged that without cause or lawful authority, and in spite of a provision therein that “no part of which said period of time is by virtue of this sentence to be spent in solitary confinement,” plaintiff was and had been for some time held in solitary confinement by defendant within the penitentiary.
An order allowing the writ was entered, and the writ was issued and served, returnable June 11, 1948.
Ón June 10, 1948, defendant filed a motion to quash the writ for the reason that plaintiff’s petition failed to state facts sufficient to constitute a cause of action against defendant or to afford plaintiff relief in habeas corpus. On June 11, 1948, the motion was argued, sub*671mitted, and overruled, at which time defendant was required to file return in 10 days, and the cause was by stipulation set for trial, consolidated with In re Application of Bortles, No. 32529, post p. 679, 35 N. W. 2d 679. Thereafter, defendant duly filed a return to the writ, and the causes were thus tried and submitted on their merits.
Thereafter, the trial court entered its judgment, finding generally for plaintiff, ordering him released and discharged from solitary confinement, and placed in usual and ordinary confinement with such privileges as are usually granted to usual and ordinary prisoners, subject to future good behavior.
Within proper time, defendant filed motion for new trial, alleging among other grounds therein that plaintiff’s petition failed to state facts sufficient to constitute a cause of action against defendant or to afford plaintiff relief in habeas corpus, therefore the trial court erred in overruling defendant’s motion to quash the writ.
Defendant’s motion for new trial was thereafter overruled, and he appealed, setting forth some 11 assignments of error, among which were the aforesaid alleged errors contained in his motion for a new trial.
Many propositions of law were presented at length in the briefs and argument, but as we view the case the only question which we are required to discuss or decide is whether or not the trial court erred in its refusal to quash the writ, and in doing so we conclude that it did.
Plaintiff’s petition discloses that he simply sought specific enforcement of an admittedly existent and valid judgment, sentence, and commitment. As will be hereinafter observed, habeas corpus could not provide him a remedy for that purpose.
As stated in In re Application of Tail, Tail v. Olson, 144 Neb. 820, 14 N. W. 2d 840: “Habeas corpus is a writ of right, but not a writ of course, and probable cause must first be shown which rightly prevents the *672writ from being trifled with by those who manifestly have no right to be at liberty. 25 Am. Jur. 153, sec. 16. Judicial discretion is exercised in its allowance, and such facts must be made to appear in the application to the court as in its judgment will, prima facie, entitle the applicant to be discharged from custody. 39 C. J. S. 436, sec. 6; 25 Am. Jur. 238, sec. 131; 29 C. J. 14.”
In McAvoy v. Jones, 149 Neb. 613, 31 N. W. 2d 740, this court recently held: “In a petition for a writ of habeas corpus, if relator sets forth facts which, if true, would entitle him to discharge, then the writ is a matter of. right and relator should be produced and a hearing held thereon to determine the questions of fact presented. But if relator shows by the facts alleged in his petition for the writ that he is not entitled to relief, then the writ should be denied.
“The sufficiency of the allegations of relator’s petition to support a writ of habeas corpus allowed by virtue thereof may be questioned before making return thereto by a motion to dissolve or quash the writ.
“Such a motion admits all ultimate facts well pleaded in relator’s petition as distinguished from conclusions of law appearing therein, and when thus tested it is ascertained that the allegations thereof are not sufficient to warrant discharge, the motion should be sustained and the writ dissolved or quashed.”
In Hawk v. Olson, 146 Neb. 875, 22 N. W. 2d 136, it was held: “The existence of a right is one matter, the availability of a particular remedy in which that right may be asserted is distinctly a separate matter.”
As stated in 39 C. J. S., Habeas Corpus, § 7, p. 437: “The writ of habeas corpus ordinarily will not be granted where there is another adequate remedy.” See, also, 29 C. J., Habeas Corpus, § 9, p. 17. Also, as stated in 39 C. J. S., Habeas Corpus, § 4, p. 430: “The sole function of the writ is to relieve from unlawful imprisonment, and ordinarily it cannot properly be used for any other purpose.” See, also, 29 C. J., Habeas Corpus, § 5, p. 12. *673It will be observed that by virtue of the provisions in section 29-2801, R. S. 1943, “persons convicted of some crime or offense for which they stand committed,” are specifically excepted from those entitled to the benefit of the act, all of which means in the final analysis that the sole issue ordinarily presented upon an application for a writ of habeas corpus by a prisoner held pursuant to judgment, sentence, and commitment, in a criminal case, is the validity of the judgment, sentence, and commitment involved therein. That is true because a void judgment, sentence, and commitment is a nullity and thus a person held pursuant thereto would not be, legally speaking, within the foregoing exception. Herein, however, their validity is admitted, which gave the court only authority to “recommit” rather than “discharge such prisoner from confinement.” See, sections 29-2805 and 29-2806, R. S. 1943.
As stated in People ex rel. Tweed v. Liscomb, 60 N. Y. 559, 19 Am. R. 211, under statutes similar in their applicable provisions with our own: “Persons committed or detained by virtue of the final judgment or decree of any competent tribunal of civil or criminal jurisdiction, or by virtue of any execution issued upon such judgment or decree, are expressly excluded from the benefit of the act. * * * Such persons are deprived of their liberty ‘by due process of law,’ and are not within the purview of the Constitution, or the purposes of the writ.”
In Matter of Morhous v. New York Supreme Court, 293 N. Y. 131, 56 N. E. 2d 79, speaking of the Tweed case, it was said: “That case has been recognized as a landmark in the history of the use of the writ of habeas corpus as appropriate process to inquire into the legality of a person’s imprisonment even where a person is imprisoned under a judgment of a court of general jurisdiction. It vindicated the right but limited the inquiry to a narrow field.” See, also, People ex rel. Hubert v. Kaiser, 206 N. Y. 46, 99 N. E. 195.
In People ex rel. Carr v. Martin, 286 N. Y. 27, 35 N. E. *6742d 636, quoting from Ex parte Siebold, 100 U. S. 371, 375, 25 L. Ed. 717, it was said: “The only ground on which this court, or any court, without some special statute authorizing it, will give relief on habeas corpus to a prisoner under conviction and sentence of another court is the want of jurisdiction in such court over the person or the cause, or some other matter rendering its proceedings void.”
In Long v. Minto, 81 Or. 281, 158 P. 805, affirming a judgment dismissing an application for writ of habeas corpus, it was said: “The right to prosecute the writ is open to any person whose liberty is restrained if he is not imprisoned or restrained by a judgment of a competent court of criminal jurisdiction. If it appears from the writ that the person is one of those excluded by the statute, then the writ cannot be allowed; or, if the court subsequently finds that the person for whose relief the writ is intended is one of those who are prohibited from prosecuting the writ, then the proceeding must be dismissed and the party remanded.”
As stated in In re Betts, 36 Neb. 282, 54 N. W. 524: “The principle deducible from the authorities already cited is that where the party applying for a writ of habeas corpus is held in custody under a process, regular on its face, issued by a court having jurisdiction of the offense charged and of the person, if the proceedings are not void, although they may be erroneous or voidable, he cannot obtain relief by habeas corpus; but where the proceedings are wholly void, because of want of jurisdiction of the court over the subject-matter, or are illegal, as distinguishable from being merely erroneous, the writ of habeas corpus is an appropriate remedy.”
In Keller v. Davis, 69 Neb. 494, 95 N. W. 1028, this court said: “The rule is certainly well- settled that on an application for a writ of habeas corpus mere errors or irregularities, not jurisdictional, are unavailing and will not be considered. In re Fanton, 55 Neb. 703. The rule applicable to such proceedings may be said to be not open *675to question; that the only subjects of inquiry, are, the jurisdiction of the court of the person and the subject matter of the offense, and jurisdiction to pronounce the particular judgment or sentence.” ■
In Iron Bear v. Jones, 149 Neb. 651, 32 N. W. 2d 125, this court recently said: “In Jackson v. Olson, 146 Neb. 885, 22 N. W. 2d 124, after review of many cases, this court said: ‘These cases have determined the rules governing the use of the writ of habeas corpus in this state. To release a person from a sentence of imprisonment by habeas corpus, it must appear that the sentence was absolutely void.’ ”
In Howard v. State, 28 Ariz. 433, 237 P. 203, 40 A. L. R. 1275, relied upon by plaintiff, the action was not habeas corpus but a contempt citation for violation of the court’s order of commitment by the superintendent of state prisons. In concluding that plaintiff therein.had pursued the proper remedy, it was said in the opinion: “But, it is argued, admitting the right petitioner has mistaken his remedy. When a man possesses a substantial right, the law will search diligently for some way of enforcing that right, and will not dismiss him without relief. It is plain that habeas corpus would not suffice to meet the emergency, for the petitioner admits he is rightfully within the prison, and secondly, that writ would not remedy a deprivation of proper food, even though it might the close confinement. What is it that petitioner complains of? Not that his sentence is being carried out in accordance with the decree of the court, but that the order directed by that court to the superintendent of the prison as its executive officer is being disregarded and violated by the latter.
“The situation thus stated obviously suggests the proper remedy.”
The decision in Kirby v. State, 62 Ala. 51, relied upon by plaintiff, was, in the final analysis, arrived at upon the basis of illegality of relator’s commitment under the habeas corpus act and other statutory provisions con*676tained in the code of Alabama, which have no similarity with our own.
Insofar as we have been able to discover, the historic remedy of habeas corpus has never been held available, in the absence of a special statute authorizing it, for the purpose of inquiring into the legality of a particular form, manner, or place of confinement executively or administratively imposed upon a prisoner lawfully in custody in a proper or authorized jail or prison under a valid, existent, and enforceable judgment, sentence, and commitment.
As early as 1843, in Ex parte Rogers, 7 The Jurist (Eng.) 992, an application for habeas corpus was brought by a prisoner against the gaoler to obtain discharge from that part of the prison in which he was confined and restore him to a greater liberty theretofore enjoyed, as well as the opportunity to exercise his trade. Therein it was said: “It is quite clear that we cannot entertain this application. The object of the writ of habeas corpus is, generally, to restore a person to his liberty, not to pronounce a judgment as to the room or part of a prison in which a prisoner ought to be confined.”
In Ex parte Cobbett, 5 Man. Gr. & S. (Eng.) 416, the applicant for a writ of habeas corpus alleged that he was improperly confined in a certain part of the prison. In holding that habeas corpus was not available, the court said: “This court has no power to interfere in the matter. The prisoner is in custody under process issuing out of the court of Chancery. If the keeper of the Queen’s prison is acting improperly in placing him in the particular part of the prison of which he complains, the ordinary means of redress for the wrong are open to him.”
In People ex rel. Stephani v. North, 91 Misc. 616, 155 N. Y. S. 595, it was said: “The placing of a convict according as he may be classified as sick or well, dangerous or peaceful, sane or insane, is a detail of prison management with which no court can interfere.
*677“Furthermore it may be said that this is a case in which no writ should in the first instance have issued.
“A writ must issue unless it appears from the petition itself that the petitioner is prohibited by law from prosecuting the writ. Code, § 2020. In this instance the petition shows that the relator was duly convicted of the crime of murder in the second degree, and duly sentenced to Sing Sing Prison for the term of life, from which prison he was (administratively) transferred to Danhemora State Hospital as an insane person. It, therefore, appeared on the face of the petition that he was detained by virtue of a final judgment of a competent tribunal of criminal jurisdiction, in which case no writ should issue. Code, § 2016. The writ is, therefore, dismissed.”
In Platek v. Aderhold, 73 F. 2d. 173, the court, in affirming a judgment denying habeas corpus, said: “The prison system of the United States is under the control of the Attorney General and Superintendent of Prisons, and not of the District Courts. The court has no power to interfere with the conduct of the prison or its discipline, but only on habeas corpus to deliver from the prison those who are illegally detained there.”
Affirming a like judgment, it was said in Sarshik v. Sanford, 142 F. 2d 676: “The courts have no function to superintend the treatment of prisoners in the penitentiary, but only to deliver from prison those who are illegally detained there. Platek v. Aderhold, 5 Cir., 73 F. 2d 173.”
Likewise, in Shepherd v. Hunter, 163 F. 2d 872, it was said: “Petitioner complains of mistreatment by prison authorities. But, it is not within the province of the courts to superintend the treatment of prisoners in the penitentiary, but only to deliver from prison those who are illegally detained there. Platek v. Aderhold, 5 Cir., 73 F. 2d 173; Sarshik v. Sanford, 5 Cir., 142 F. 2d 676.”
Snow v. Roche, 143 F. 2d 718, certiorari denied 323 U. S. 788, 65 S. Ct. 311, 89 L. Ed. 629, was an application for an original writ of mandamus to compel a judge of the *678district court to entertain and decide an application for a writ of habeas corpus, which had been previously dismissed for failure to state facts sufficient to state á cause of action and afford petitioner the relief sought. In that opinion it was said: “The petition here contains the recital of the entire petition for the writ of habeas corpus hereinabove referred to, and we have studied it with care. In no part of such petition is the legal custody of petitioner questioned. He does not claim the deprivation of any constitutional right in the conviction of the crime for which he is incarcerated, in the commitment to respondent, or in the legality of his detention. He complains that he has been illy and inhumanely treated in the matter of food and of dental and medical treatment, and that he has been confined to the ‘Isolation Block’ which he sometimes refers to as the ‘Hole’ or ‘Black Hole.’ * * *
“The allegations of this petition, if taken as true, do not claim or establish the illegal detention of the petitioner, and, therefore, as it seems to us, the sphere of the writ of habeas corpus does not reach to the subject matter of his complaint. * * *
“ ‘The purpose of the proceeding defined by the (English) statute was to inquire into the legality of the detention, and the only judicial relief authorized was the discharge of the prisoner or his admission to bail, and that only if his detention were found to be unlawful. * * * There is no warrant in either the statute or the writ for its use to invoke judicial determination of questions which could not affect the lawfulness of the custody and detention, and no suggestion of such a use has been found in the commentaries on the English common law. Diligent se'arch of the English authorities and the digests before 1789 has failed to disclose any case where the writ was sought or used, either before or after conviction, as a means of securing the judicial decision of any question which, even if determined in the prisoner’s favor, could not have resulted in his immediate release.
“ ‘Such use of the writ in the (United States) federal *679courts is without the support of history or of any language in the statutes which would indicate a purpose to enlarge its traditional function.’ * * *
“The petition on its face clearly indicates that the gist of petitioner’s complaint is that the manner of his treatment is unnecessarily harsh and is painful and injurious to him. We have seen that the writ of habeas corpus is not the vehicle to carry his appeal for relief. Therefore, the petition for the writ of mandamus is denied, and the proceeding is dismissed.”
Beaudin v. Landriault, 23 Que. Pr. 215, 38 Can. Cr. Cas. 12, was in principle almost identical with the case at bar. Therein, petitioner contended that she was unlawfully deprived of her liberty because in fact she was being subjected to “hard labor” in violation of the terms of her sentence and commitment, which provided that she should be imprisoned “without hard labor.” The court, in its opinion, quashed the writ upon the ground that her remedy was not habeas corpus but recourse to the prison authorities, as provided in the statutes.
There are many other authorities of similar import from other jurisdictions, but to cite them would but unduly prolong this opinion.
For the reasons heretofore stated, the judgment of the district court should be and hereby is reversed and the action is dismissed.
Reversed and dismissed.
Paine, J., not participating.