
775 N.W.2d 196 (2009)
18 Neb. App. 112
Mattieo A. CONDOLUCI, appellant,
v.
STATE of Nebraska, appellee.
No. A-09-638.
Court of Appeals of Nebraska.
November 3, 2009.
*197 Mattieo A. Condoluci, pro se.
John W. Reisz, Deputy Sarpy County Attorney, for appellee.
SIEVERS and CASSEL, Judges, and HANNON, Judge, Retired.
SIEVERS, Judge.
According to his application for writ of habeas corpus filed May 20, 2009, in the district court for Sarpy County, Mattieo A. Condoluci was released on January 5, 2009, from the custody of the Nebraska Department of Correctional Services after serving his sentence for sexually assaulting a child. He was, however, immediately taken into custody by the Sarpy County sheriff and incarcerated in the Sarpy County jail, where he remained as of the time he filed the referenced application. This custody occurred because of a petition filed by the Sarpy County Attorney with the Sarpy County Mental Health Board (the Board), a copy of which Condoluci attached to his application. Such petition alleges that Condoluci is a dangerous sex offender. The prayer of the petition asked the chair of the Board to issue a warrant directing the sheriff to take custody of Condoluci and hold him in the Sarpy County jail pending further order of the Board.
Condoluci's application further alleges that to his knowledge, "no court or chair of the ... Board found probable cause to believe that [he] is a dangerous sex offender as mandated by Neb.Rev.Stat. § 71-1206(2)." He alleges that he has never received a summons, which is a violation of his due process rights under Neb.Rev.Stat. § 71-1207 (Cum. Supp. 2008). He alleges that his rights under such statute have further been violated because he has not received the hearing that must be scheduled "within seven calendar days after the subject has been taken into emergency protective custody." See § 71-1207. Condoluci alleges that because of the violations of his due process rights as specified in his application, he is being unlawfully detained in the Sarpy County jail. Thus, he requested the court issue an order releasing him from custody and set an expeditious hearing in the matter so that sufficient evidence may be adduced to adjudicate the matter.
On May 28, 2009, the district court, apparently acting sua sponte, entered the following order:
The Court having considered [Condoluci's] application for a Writ of Habeas Corpus hereby denies the same, without hearing, for the following reasons:
1. A duly certified Petition before the Board ... was filed and [Condoluci] was taken into custody pursuant to an Order of Detention signed by the Chairperson of the Board....
2. The Court notes a majority of the complaints of the Application deal with procedural defects in his being detained as a dangerous sex offender for which he has an adequate remedy at law *198 and for which Habeas Corpus will not lie.
IT IS THEREFORE ORDERED, ADJUDGED AND DECREED by the Court that [Condoluci's] Application for a Writ of Habeas Corpus is denied and the application is dismissed.
Because there was no hearing, there is obviously no bill of exceptions; and although the district court relies on an "Order of Detention signed by the Chairperson of the Board," such is not in our record. Given the district court's recitation that no hearing was held, we are forced to conclude that the district court did not acquire knowledge of the purported "Order of Detention" by a proper evidentiary process. At oral argument upon Condoluci's appeal from the quoted order, the deputy Sarpy County Attorney conceded, after our questioning, that we should remand the cause to the district court because of the lack of a proper evidentiary hearing. While we do remand the cause, we are not unconcerned by the county attorney's failure to promptly seek an order of remand in view of the district court's obvious error in deciding the case in reliance upon a document not in evidence.
Additionally, Condoluci alleges in his application that he has been held in the Sarpy County jail since January 5, 2009, without service of summons. And he alleges that he has been held without the benefit of a hearing before the Board, which must be held within 7 days of when he was taken into emergency protective custody under the Sex Offender Commitment Act. Section 71-1207 of the act does require service of a summons upon the subject which "fix[es] a time for the hearing within seven calendar days after the subject has been taken into emergency protective custody." In short, that which Condoluci asserts in order for his custody to be continued is, in fact, provided for by statute. The district court's order makes no finding as to whether the required hearing has been held.
Habeas corpus is a civil remedy constitutionally available in a proceeding to challenge and test the legality of a person's detention, imprisonment, or custodial deprivation of the person's liberty. See, U.S. Const. art. I, § 9; Neb. Const. art. I, § 8; In re Application of Tail, 144 Neb. 820, 14 N.W.2d 840 (1944). Our habeas statute, Neb.Rev.Stat. § 29-2801 (Reissue 2008), provides in pertinent part:
[I]f the person so imprisoned or detained is imprisoned or detained without any legal authority, upon making the same appear to such judge, by oath or affirmation, it shall be his duty forthwith to allow a writ of habeas corpus, which writ shall be issued forthwith by the clerk of the district court, or by the county judge, as the case may require, under the seal of the court whereof the person allowing such writ is a judge, directed to the proper officer, person or persons who detains such prisoner.
Condoluci's application is under oath, and if the allegations thereof are true, then his detention in the Sarpy County jail is quite clearly "without any legal authority." Accordingly, the district court should issue the writ. The Supreme Court explained in In re Application of Tail:
"[The writ of habeas corpus] may be analogized to a proceeding in rem, and is instituted for the sole purpose of having the person restrained of his liberty produced before the judge, in order that the cause of his detention may be inquired into and his status fixed. The person to whom the writ is directed makes response to the writ, not to the petition.... The respondent, in his answer to the writ, seeks simply to justify *199 his conduct and relieve himself from the imputation of having imprisoned without lawful authority a person entitled to his liberty. He comes to no issue with the applicant for the writ. He answers the writ."
144 Neb. at 822-23, 14 N.W.2d at 842 (quoting Simmons v. Georgia Iron & Coal Co., 117 Ga. 305, 43 S.E. 780 (1903)).
Therefore, the district court erred in failing, given the facial showing of an illegal detention in the sworn application, to inquire into the cause of Condoluci's detention by having those detaining Condoluci answer the writ.

CONCLUSION
We find the trial court erred in failing to issue the writ of habeas corpus and in dismissing the application for such in reliance upon matters not in evidence. We reverse the dismissal and remand the cause for further proceedings, with directions to the district court to issue the writ of habeas corpus and to hold an evidentiary hearing thereupon in accordance with Neb.Rev.Stat. §§ 29-2802 and 29-2805 (Reissue 2008).
REVERSED AND REMANDED FOR FURTHER PROCEEDINGS.
