
56 N.W.2d 138 (1952)
156 Neb. 340
SEDLACEK
v.
HANN.
No. 33283.
Supreme Court of Nebraska.
December 19, 1952.
*139 L. R. Doyle, Lincoln, for appellant.
Clarence S. Beck, Atty. Gen., Clarence A. H. Meyer, Deputy Atty. Gen., for appellee.
Heard before SIMMONS, C. J., and CARTER, MESSMORE, YEAGER, CHAPPELL, WENKE, and BOSLAUGH, JJ.
BOSLAUGH, Justice.
The district court sustained the motion of appellee made before return day of the writ of habeas corpus to quash it on the ground that the petition for the writ did not state facts sufficient to justify its allowance. The writ was dissolved. This appeal is from that adjudication.
The sufficiency of the petition of the relator to support a writ of habeas corpus allowed by virtue thereof may be tested before making return thereto by a motion to quash. It is the right and duty of the court to set aside the writ, if the facts well pleaded therein when accepted as true are insufficient to entitle the relator to the relief sought. In re Application of Dunn, 150 Neb. 669, 35 N.W.2d 673; Sedlacek v. Greenholtz, 152 Neb. 386, 41 N.W. 2d 154.
Appellant states in his petition that his imprisonment and restraint are because of a judgment and sentence rendered by and entered in the district court for Saline County on February 21, 1947, to the effect that he be confined in the State Penitentiary *140 for a period of 10 years as punishment for the crime of burglary. There is no claim of defect in the jurisdiction of the court over the person of appellant or of the subject matter of the case in which he was convicted of the crime of burglary and in which the sentence was imposed by virtue of which he is now detained in prison. It is asserted that the judgment and sentence are void because in the period between the conviction and the time when sentence was imposed appellant became insane, and at the time the judgment was rendered he was mentally and physically incapacitated. Section 29-1822, R.R.S. 1943, provides: "* * * If, after the verdict of guilty, and before judgment pronounced, such person becomes lunatic or insane, then no judgment shall be given while such lunacy or insanity shall continue * * *." It was recently decided in a case to which appellant was a party that this provision of the statute imposes a duty on but does not go to and does not affect the jurisdiction of the court; that the mental status of an accused at the time of sentence is a question of fact for the consideration and determination of the court having jurisdiction of the offense; and that the judgment of the court may not be collaterally attacked on that issue in a habeas corpus proceeding. Sedlacek v. Greenholtz, supra.
It was also pleaded that the judgment, because of which appellant is confined in custody, is void for the reason that it is based on a crime claimed to have been committed by him when he was mentally incompetent to commit the crime. Insanity is recognized as a defense in this state in a criminal case, if at the time of the commission of the offense the accused does not know right from wrong with respect to the particular act involved in the offense. Evidence of insanity existing at the time of the offense may be presented in defense of the accused at the trial of the offense charged. It is not available as a ground of habeas corpus, after conviction, for discharge of the accused from the sentence for the obvious reason that it would be the substitution of the remedy of habeas corpus for error proceedings. In re Carbino, 117 Neb. 107, 219 N.W. 846; McAvoy v. Jones, 149 Neb. 613, 31 N.W.2d 740.
Each of the specifications in the petition of invalidity of the sentence of the accusedthat the district court for Saline Couny was biased and prejudiced against appellant, refused him a change of venue for the trial of the offense charged against him, conducted the trial in a county "seething with prejudice and passion" against him, ordered him held under arrest at the trial for burglary; that the information under which he was tried did not charge an offense under the laws of Nebraska; and that the form of the sentence is contrary to lawwould have been proper for review and determination in an error proceeding in this court. They may not be considered by this court in this proceeding. It has frequently been determined, and recently repeated by this court, that habeas corpus is a collateral and not a direct proceeding when regarded as a method of attack of a judgment imposing a sentence for crime; that facts as distinguished from legal conclusions are required to negative the legal force and effect of a judicial record of a court of general jurisdiction; that the remedy of habeas corpus may not be substituted for error proceedings; and that release from confinement in accordance with a sentence in a criminal case may be had by habeas corpus only when the judgment is void. Swanson v. Jones, 151 Neb. 767, 39 N.W.2d 557; Truman v. Hann, 154 Neb. 501, 48 N.W.2d 418.
The conclusions in the petition that appellant is unlawfully imprisoned and restrained of his liberty by appellee; that his confinement in the State Penitentiary violates the provisions of the federal Constitution prohibiting the deprivation of liberty without due process of law and guaranteeing equal protection of the laws; and that the courts of Nebraska have not accorded him a full and fair "adjudication of the Federal questions raised"are immaterial in this case. An individual convicted of a crime for which he is committed *141 is excepted from those entitled to the benefit of a statute on the subject of habeas corpus. Section 29-2801, R.R.S. 1943. Such writ is not demandable of course but legal cause therefore must be shown as a prerequisite of judicial action favorable to the relator. Swanson v. Jones, supra. The judgment of a court of record in a criminal case imposing sentence on an accused if challenged by habeas corpus has the presumption of regularity and validity. McAvoy v. Jones, supra. A statement in a petition of the reason that the detention of relator is illegal in the form of conclusions is not sufficient to justify the allowance of a writ of habeas corpus. The petition must state facts sufficient to show illegal detention. Stapleman v. Hann, 155 Neb. 410, 51 N.W.2d 891.
Appellant alleges in his petition that after he was committed and was detained in the State Penitentiary he was found to be insane by the prison physician, the medical board thereof, and the insanity commission, and that he was sent to one of the Nebraska state hospitals. This is not important in this case. The remedy of habeas corpus is not available in the absence of a 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 an authorized place under a valid sentence and commitment. Swanson v. Jones, supra.
The petition recites that the record of the trial resulting in the conviction of appellant of burglary was destroyed and that he could not since his conviction secure a transcript thereof. He also complains that the district court for Lancaster County refused his application to grant and fix bail in this proceeding permitting him to have his liberty during the pendency of the habeas corpus case. The record does not show that the trial court considered or acted upon the application for bail. Neither of these matters is discussed in the brief of appellant. They do not merit further consideration. Sedlacek v. Greenholtz, supra.
Appellant has failed to allege any fact impeaching the jurisdiction of the district court for Saline County of the offense for which he was convicted or the jurisdiction of that court over his person or that the sentence imposed was without the power of the court.
The judgment of the district court should be and it is affirmed.
Affirmed.
