The record here discloses that appellant, Irving Tail, hereinafter called relator, filed an application on December 22, 1943, in the district court for Lancaster county, Nebraska, praying the allowance of a writ of habeas corpus directed to Neil Olson, Warden of the Nebraska penitentiary, respondent. The trial court examined the application and on January 3, 1944, entered a written opinion and judgment denying the application and refusing to grant the writ upon the ground that the application did not state facts sufficient to constitute a cause of action for allowance of the writ. On January 20, 1944, the trial court overruled relator’s motion to set aside the judgment and grant a new trial. Thereafter relator took all of the required statutory steps for appeal to this court.
The attorney general then filed and presented for argument here a special appearance on behalf of respondent contending that this court is without jurisdiction over the person of respondent, appellee, he never having been served with process in any manner either in the lower court or in this court. It appears under the circumstances as above outlined that if the judgment of the trial court was a final order, appealable and reviewable by this court, the questions involved are all answered.
It is generally agreed by the.authorities that at common law an appeal does not lie in habeas corpus proceedings, but under the Constitutions and statutes of most jurisdictions all judgments or orders, if final, are reviewable. The right to a review of judgments or orders in habeas corpus pro*822ceedings being purely statutory, it exists only in such cases and to the extent provided by applicable statutes. 39 C. J. S. 705, 707, sec. 109b; Church, Habeas Corpus (2d ed.) 590, sec. 389b, 592, sec. 389e. Because of differences in statutes and their interpretations by courts of the various jurisdictions, the authorities- are in conflict upon the question here involved. 39 C. J. S. 705, 707, sec. 109b.
To judicially solve the problem we are required to consider the nature of habeas corpus proceedings as well as the provisions of our Constitution and statutes. By section 8, art. I of our Constitution it is provided: “The privilege of the writ of habeas corpus shall not be suspended, unless in case of rebellion or invasion, the public safety requires it, and then only in such manner as shall be prescribed by law.” It has been said that the writ of habeas corpus is the precious safeguard of personal liberty and there is no higher duty imposed upon courts and legislative bodies than to maintain it unimpaired. 39 C. J. S. 424, sec. 1. Habeas corpus, under statutes like our own, is a special proceeding, civil in character providing a summary remedy open to persons illegally detained. 39 C. J. S. 424, sec. 1; 1 C. J. S. 1096, sec. 43; 1 C. J. 1010; 29 C. J. 8; People ex rel. Curtis v. Kidney, 225 N. Y. 299, 122 N. E. 241; Winnovich v. Emery, 33 Utah 345, 93 Pac. 988. It has been held that the proceedings are not adversary in character, are not in a technical sense a suit between the applicant and the officer, whose responsibility ceases, when he makes return to. the writ and brings the applicant into court, for the court to pass upon the ultimate question whether or not the applicant is unlawfully restrained of his liberty. Addis v. Applegate, 171 Ia. 150, 154 N. W. 168; 39 C. J. S. 424, sec. 1; 29 C. J. 6. This court has held that a habeas corpus proceeding involving the custody of a child is a proceeding in rem, in which the res is the child and its custody. Terry v. State, 77 Neb. 612, 110 N. W. 733. As has been ably stated by other judicial authority, “It 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 *823judge, 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 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.” Simmons v. Georgia Iron & Coal Co., 117 Ga. 305, 43 S. E. 780. See, also, Comp. St. 1929, secs. 29-2802, 29-2817; 25 Am. Jur. 241, sec. 137. Also, it has been held that since the issues are raised by the return to the writ, the function of the petition is to procure the issuance of the writ, and ordinarily when this is done, the petition is functus officio for procedural purposes. 25 Am. Jur. 235, sec. 124. We are unable to find any provision in our statutes for service upon respondent of any other process except the writ, although in a few other jurisdictions, either by rule or statute, it is required that an order to show cause why the writ should not be allowed should be served upon respondent. Walker v. Johnston, 312 U. S. 275, 61 S. Ct. 574.
Our statute, section 29-2801, Comp. St. 1929, as applicable here, provides: “If any person, * * * shall be unlawfully deprived of his or her liberty, and shall make application, * * * to any one of the judges of the district court, * * * and does at the same time produce to such judge a copy of the commitment or cause of detention of such person, or if 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, * * * .” (Italics supplied.) Other sections of the same chapter provide for service of the writ, return, hearing, and review.
It is generally held that the trial court may refuse to allow a writ of habeas corpus where the facts alleged in the application would not warrant discharge of the prisoner, and the grant or refusal of the writ is a judicial act. 1 Bailey, Habeas Corpus, 13, sec. 5; Goetz v. Black, 256 Mich. *824564, 240 N. W. 94, 84 A. L. R. 802. Habeas corpus is a writ of right, but not a writ of course, and probable cause must first be shown which rightly prevents the writ 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. Therefore, since the allowance of the writ by the court is a judicial act, as distinguished from a ministerial one, it is generally held that mandamus will not lie to compel a judge to award a writ of habeas corpus upon his refusal to do so. 25 Am. Jur. 239, sec. 133.
The constitutional and statutory right of appeal in habeas corpus proceedings is now given in most states, and it operates as a substitute for successive applications from court to court, or judge to judge, which the prisoner had a right to make at common law, in case his application was refused. Church, Habeas Corpus (2d ed.) 590, sec. 389b. Such successive applications are not appeals since each court and judge thereof exercises a primary jurisdiction. That procedure was always attended by some danger of injustice and hazard of hardship or expense to both the prisoner and the state. As a result legislative bodies including our own have substituted the right of appeal for the successive applications permissible at common law. Church, Habeas Corpus (2d ed.) 601, sec. 389g. In this connection, it is to'be noted that the statute (Comp. St. 1929, sec. 29-2801), provides that the application shall be made to any one of the judges of the district court, and this court has held that “An application for a writ of habeas corpus to release a prisoner confined under sentence of court must be brought in the county where the prisoner is confined.” Gillard v. Clark, 105 Neb. 84, 179 N. W. 396.
The Constitution of Nebraska, art. I, sec. 24, provides: “The right to be heard in all civil cases in the court of last resort, by appeal, error, or otherwise, shall not be denied.” *825Responding thereto section 29-2823, Comp. St. 1929, provides: “The proceedings upon any writ of habeas corpus shall be recorded by the clerk and judges, respectively, and may be reviewed as provided by law for appeal in civil cases.” Also, section 20-1911, Comp. St. 1929, “A judgment rendered.or final order made by the district court may be reversed, vacated or modified by the supreme court, for errors appearing on the record.” And, section 20-1902, Comp. St. 1929, “An order affecting a substantial right in an action, when such order in effect determines the action and prevents a judgment, and an order affecting a substantial right made in a special proceeding, * * * is a ‘final order’ which may be vacated, modified or reversed, as provided in this chapter and chapter 19.”
The question of the right to appeal from a disallowance of the writ has never been heretofore directly raised in this court, although the right to review generally final orders in habeas corpus cases has been recognized and the procedure well established. In re White, 33 Neb. 812, 51 N. W. 287; In re Van Sciever, 42 Neb. 772, 60 N. W. 1037; State v. Decker, 77 Neb. 33, 108 N. W. 157; In re Application of Selicow, 100 Neb. 615, 160 N. W. 991; Gillard v. Clark, supra. In several other cases it has evidently been assumed that denial of the writ was a final order and reviewable. For example, in Hawk v. O’Grady, 137 Neb. 639, 290 N. W. 911, and Alexander v. O’Grady, 137 Neb. 645, 290 N. W. 718, appeals were directly taken to this court from denials of the writ by the trial court, and therein it was adjudged whether the application stated a cause of action requiring allowance of the writ.
It is generally lield that an ex parte judgment is appeal-able where a statute reasonably construed gives a right of appeal therefrom. 4 C. J. S. 337, sec. 157. The test of finality for the purpose of an appeal in a habeas corpus proceeding is not necessarily whether the whole matter involved in the action is concluded, but whether the particular proceeding or action is terminated by the judgment. Any judgment which ends the particular action or proceeding is final *826for the purposes of appeal, if an appeal is permissible. Win-no-vich v. Emery, supra.
There are numerous authorities holding that appeal will lie from denial of the writ under constitutional and statutory provisions in many respects similar to our own. In re Hammill, 9 S. Dak. 390, 69 N. W. 577, includes this statement : “When instituted in the circuit court, its decision will be a final order, affecting a substantial right made in a special proceeding, from which an appeal will lie to this court.” See, also, State ex rel. Keyes v. Buckham, 29 Minn. 462, 13 N. W. 902. In Ex parte Edwards, 11 Fla. 174, the court held that, “error will lie to the Supreme Court from a refusal to grant a writ of habeas corpus,” which was reaffirmed in Cooper v. Lipscomb, 97 Fla. 668, 122 So. 5. In In re Jennings, 46 Idaho 142, 267 Pac. 227, an application for a writ of habeas corpus was denied by the district court and appeal taken to the supreme court, wherein it was urged that the order was not a final judgment. However, the supreme court overruled the contention citing, quoting from, and relying upon Winnovich v. Emery, supra. See, also, Costello v. Palmer, 20 App. D. C. 210; 25 Am. Jur. 239, sec. 133. Likewise, in Ex parte Quirin, 317 U. S. 1, 63 S. Ct. 2, decided as late as July 31, 1942, the supreme court of the United States said (p. 24),: “While it is the usual procedure on an application for a writ of habeas corpus in the federal courts for the court to issue the writ and on the return to hear and dispose of the case, it may without issuing the writ consider and determine whether the facts alleged by the petition, if proved, would warrant discharge of the prisoner. Walker v. Johnston, 312 U. S. 275, 284. Presentation of the petition for judicial action is the institution of a suit. Hence denial by the district court of leave to file the petitions in these causes was the judicial determination of a case or controversy, reviewable on appeal to the Court of Appeals and reviewable here by certiorari. See Ex parte Milligan, 4 Wall. 2, 110-13; Betts v. Brady, 316 U. S. 455, 458-461.” See, also, Church, Habeas Corpus (2d ed.) 592, sec. 389d.
*827It would seem conclusive, under our constitutional and statutory provisions, that the case at bar is a proceeding upon a writ of habeas corpus which may be reviewed as provided by law in civil cases. Thus, we decide that the denial of relator’s application for a writ of habeas corpus and the refusal to allow the writ by the district court was a final order affecting a substantial right made in a special proceeding, which in effect terminated the action. Such a final order is reviewable upon appeal to this court, thereby presenting for decision the sole question of whether relator’s application states facts sufficient to constitute a cause of action requiring the allowance of a writ of habeas corpus. Therefore, the special appearance of respondent is hereby overruled.