
598 N.W.2d 39 (1999)
257 Neb. 406
Cary REHBEIN, appellant,
v.
Harold CLARKE, director, Nebraska Department of Correctional Services, appellee.
No. S-97-1289.
Supreme Court of Nebraska.
August 6, 1999.
*42 Cary Rehbein pro se.
Don Stenberg, Attorney General, and David T. Bydalek, Lincoln, for appellee.
HENDRY, C.J., WRIGHT, CONNOLLY, GERRARD, STEPHAN, McCORMACK, and MILLER-LERMAN, JJ.
WRIGHT, J.

NATURE OF CASE
This is an appeal from a denial of a petition for a writ of habeas corpus in which Cary Rehbein seeks relief on the grounds that his trial counsel was ineffective and that Rehbein is a hermaphrodite wrongfully confined in a male prison. The Lancaster County District Court sustained the State's demurrer and dismissed Rehbein's petition for failure to state a claim for habeas corpus.

SCOPE OF REVIEW
When habeas corpus is used to test the validity of adult criminal detention, factual issues are to be reviewed as in actions at law. Bradley v. Hopkins, 246 Neb. 646, 522 N.W.2d 394 (1994).
The findings of a trial court in a law action in which the court served as the finder of fact have the effect of a verdict and will not be set aside unless clearly wrong. Hilliard v. Robertson, 253 Neb. 232, 570 N.W.2d 180 (1997).
To the extent issues of law are presented, an appellate court has an obligation to reach independent conclusions irrespective of the determinations made by the court below. Doe v. Zedek, 255 Neb. 963, 587 N.W.2d 885 (1999).

FACTS
On May 30, 1997, Rehbein filed a "Petition for Writ of Habeas Corpus." The State demurred to the petition on the basis that the allegations contained in the petition did not state facts sufficient to constitute a cause of action and that the petition did not have attached to it a copy of Rehbein's commitment and detention order, as required by Neb.Rev.Stat. § 29-2801 (Reissue 1995). Subsequently, Rehbein filed numerous pleadings, including a "Motion to File Amendment to Original Filing" and a "Motion for Hearing of Evidence to Support Action in Docket 556 Page 153 in Judge McGinn[`]s Court and Motion to Transport Person From Correction." Rehbein also filed a "Motion to Go to Retrial on a Hearing for State Habe[a]s Filing and Release for Unlawful Incar[c]eration."
On November 17, 1997, the district court sustained the State's demurrer, finding that Rehbein's petition failed to allege facts constituting a cause of action for habeas corpus. The district court noted that this court had already considered and denied granting relief to Rehbein regarding five of Rehbein's allegations. See State v. Rehbein, 235 Neb. 536, 455 *43 N.W.2d 821 (1990). The district court found that Rehbein's sixth allegation, that Rehbein is actually "`more female than male'" and is therefore improperly confined in a male correctional facility, did not state a cause of action for habeas corpus. The district court thereupon dismissed the petition, noting that it did not believe that Rehbein's petition could be amended so as to correct any defects. Rehbein timely appealed.

ASSIGNMENTS OF ERROR
Those claims which were presented to the district court and properly assigned as error on appeal are as follows: (1) The district court erred in denying Rehbein's petition for habeas corpus relief, because his guilty plea at trial was not entered into voluntarily, as he was under the influence of drugs, and (2) no presentence investigation was performed, so the trial court sent him to a male prison even though he is "more female than male" and, thus, violated his right under the Eighth Amendment of the U.S. Constitution to be free from cruel and unusual punishment.

ANALYSIS
Habeas corpus is a special civil proceeding providing a summary remedy to persons illegally detained. See In re Application of Tail; Tail v. Olson, 144 Neb. 820, 14 N.W.2d 840 (1944). A writ of habeas corpus is a remedy which is constitutionally available in a proceeding to challenge and test the legality of a person's detention, imprisonment, or custodial deprivation of liberty. See Flora v. Escudero, 247 Neb. 260, 526 N.W.2d 643 (1995).
A writ of habeas corpus in this state is quite limited in comparison to those of federal courts, which allow a writ of habeas corpus to a prisoner when he is in custody in violation of the federal Constitution, law, or treaties of the United States. Case v. State, 177 Neb. 404, 129 N.W.2d 107 (1964), vacated on other grounds 381 U.S. 336, 85 S.Ct. 1486, 14 L.Ed.2d 422 (1965). It is established that where a judgment is attacked in a way other than a proceeding in the original action to have the judgment vacated, reversed, or modified, or a proceeding in equity to prevent its enforcement, the attack is considered a "collateral attack." Mayfield v. Hartmann, 221 Neb. 122, 375 N.W.2d 146 (1985). An action for habeas corpus is an example of such a collateral attack. Berumen v. Casady, 245 Neb. 936, 515 N.W.2d 816 (1994).
Only a void judgment may be collaterally attacked. Mayfield v. Hartmann, supra. Where the court has jurisdiction of the parties and the subject matter, its judgment is not subject to collateral attack. Id. A writ of habeas corpus will not lie to discharge a person from a sentence of penal servitude where the court imposing the sentence had jurisdiction of the offense, had jurisdiction of the person of the defendant, and the sentence was within the power of the court to impose. Anderson v. Gunter, 235 Neb. 560, 456 N.W.2d 286 (1990).
Rehbein's initial petition for writ of habeas corpus asserted that his imprisonment was illegal because (1) his trial counsel entered a plea of guilty without Rehbein being present; (2) at the time the plea was entered, Rehbein was on a psychotropic drug and was totally unable to assist in the preparation of his own defense; (3) he received ineffective assistance of counsel; (4) there was no factual basis for his plea; (5) the plea was not knowingly and freely entered; and (6) Rehbein is a hermaphrodite, being "more female than male," and therefore is illegally confined to a male facility.
In Sileven v. Tesch, 212 Neb. 880, 326 N.W.2d 850 (1982), we stated that there was a distinction between want of jurisdiction and error in the exercise of that jurisdiction. Where jurisdiction has attached, mere errors or irregularities in the proceedings, however grave, although they may render the judgment erroneous *44 and subject to be set aside in a proper proceeding for that purpose, will not render the judgment void. A writ of habeas corpus is not a writ for correction of errors, and its use will not be permitted for that purpose. Nicholson v. Sigler, 183 Neb. 24, 157 N.W.2d 872 (1968).
In other words, the regularity of the proceedings leading up to the sentence in a criminal case cannot be inquired into on an application for writ of habeas corpus, for that matter is available only in a direct proceeding. See id. In a petition for writ of habeas corpus, if the plaintiff sets forth facts which, if true, would entitle him or her to discharge, then the writ is a matter of right, the plaintiff should be produced, and a hearing should be held thereon to determine questions of fact presented. If the plaintiff fails to show by the facts alleged in the petition that he or she is entitled to relief, then the relief is denied. See Lingo v. Hann, 161 Neb. 67, 71 N.W.2d 716 (1955).
Here, the State filed a "return," or showing, in response to Rehbein's petition for a writ of habeas corpus. The State claimed that Rehbein's petition should be dismissed because the allegations contained therein did not state facts sufficient to constitute a cause of action and because Rehbein had failed to attach a copy of his commitment and detention order, as required by § 29-2801. The district court treated the State's response as a demurrer.
In Almarez v. Hartmann, 211 Neb. 243, 318 N.W.2d 98 (1982), the court also treated as a demurrer a motion which requested that the petition for habeas corpus be dismissed on the ground that the allegations, even if true, were wholly insufficient to support the writ. Generally, the sufficiency of a writ of habeas corpus is not challenged by demurrer, but, instead, is challenged by a motion to quash. See McAvoy v. Jones, 149 Neb. 613, 31 N.W.2d 740 (1948). We have, however, stated that a demurrer may be allowed to serve the purpose of a motion to quash or to dismiss a writ of habeas corpus. Id. Therefore, even though the district court treated the State's motion as a demurrer, a motion which is usually not associated with writs of habeas corpus, we will treat the State's motion as one to quash Rehbein's petition.
On a motion to quash a writ of habeas corpus, as in a demurrer, the allegations of the petition are deemed admitted, and the usual presumptions in support of the jurisdiction of a court of general jurisdiction whose proceedings are collaterally attacked will be made. See id. Where the petition is not sufficient to warrant discharge, it should be quashed. Id.
In his petition, Rehbein alleges that his guilty plea was not entered voluntarily and that, as a consequence, his trial counsel was ineffective in allowing him to plead. This complaint does not question the jurisdiction of the trial court over the crime or the defendant. Neither does the complaint question the authority of the trial court to impose the sentence given, and thus, it may not be raised in a writ of habeas corpus.
Next, Rehbein claims that he possesses "46xx" chromosomes and, thus, is a hermaphrodite. He argues that his genetic makeup is more female than male and that he should not be housed in a male prison. We reiterate that habeas corpus will not lie to discharge a person from a sentence of penal servitude where the court imposing the sentence has jurisdiction over the offense and the defendant and the sentence was within the power of the court to impose. Anderson v. Gunter, 235 Neb. 560, 456 N.W.2d 286 (1990). Rehbein was convicted of felony murder, and he was sentenced to life in prison pursuant to Neb.Rev.Stat. § 29-2522 (Reissue 1989). Rehbein advances no claim which undermines the jurisdiction of the trial court or which would prove that the court was acting beyond its power when it sentenced him to life in prison. In short, Rehbein does not seek to void his *45 sentence, but, instead, attacks a condition of his confinement. We have held that a writ of habeas corpus is not available to challenge the conditions of confinement of a prisoner under a valid sentence. Pruitt v. Parratt, 197 Neb. 854, 251 N.W.2d 179 (1977). Therefore, Rehbein's assigned error is without merit.
We express no opinion as to whether Rehbein may challenge his confinement through a writ of mandamus or other method. See 68 Neb. Admin. Code, ch. 9, § 004 (1987) (directs Department of Correctional Services to assign female inmates to Nebraska Center for Women). See, also, Long v. Nix, 86 F.3d 761 (8th Cir. 1996) (transsexual inmate brought action pursuant to 42 U.S.C. § 1983 (1994), claiming inmate was denied appropriate living conditions and medical treatment).

CONCLUSION
The district court's dismissal of Rehbein's petition for a writ of habeas corpus is affirmed.
AFFIRMED.
