delivered the opinion of the court.
The first question to be determined must, necessarily, be the extent of the jurisdiction of a court on habeas corpus proceedings ; and whether they can embrace an accounting and warrant a court in decreeing money judgments and make the custody of the child dependent upon compliance with the decretal orders for the payment of money.
In this ease there were no orders or decree finding and adjudging the custody of the child to either party, except coupled inextricably with decrees for money payments, and the legal right to the custody of the child appears to have been found both ways, and the child redelivered to the defendant as a chattel in pledge, subject to redemption by the father.
One striking peculiarity in regard to the adjudication of the money value of .the child, or the amount for which it was hypothecated by the court, was the fact that the proceeding appears to have been purely ex parte, without pleadings or issues, — one in which the respondent was not expected or allowed to participate.
Prominent among the early cases decided in the federal court was U. S. v. Green, 3 Mason, C. C. 482, where the character and nature of the proceeding is defined by the court as follows:
“ A proceeding by habeas corpus can in no legal sense be regarded as a suit or controversy between private parties. It is an inquisition by the government, at the suggestion *526and instance of an individual, most probably, but still in the name and capacity of the sovereign.”
In Ex parte Milligan, 4 Wall. 2, it is said: “ A petition for a habeas corpus duly presented is the institution of a cause in behalf of the petitioner and the allowance or refusal of the process as well as the subsequent disposition of the prisoner, is matter of law and not of discretion.”
The rule as stated in Church on Habeas Corpus, sec. 170, appears to be concise and definite and in harmony with all leading English and American decisions. It is, “ That only those matters which have a necessary connection with the question of the validity of the detention or imprisonment will be considered; and all other matters will be uniformly rejected.”
It will therefore be seen that the proceeding is confined in very narrow limits, and cannot be extended to the adjudication of claims or money demands and unsettled accounts between the parties. The only jurisdiction of the court was to determine whether the father or aunt had the better right to the child and decree it to such custody. See also, People v. Porter, 1 Duer (N. Y.) 709; State v. Bird, 18 N. J. Eq. 194; State v. Banks, 25 Ind. 495; Wilcox v. Wilcox, 22 Barb. 178.
Hence, the child being in the custody of the father, in the order of November 25th the words “ doth deny the said petition” exhausted the power and jurisdiction of the court, and the balance of the order providing for the adjustment of accounts and the payment of money by the plaintiff to the defendant, was void.
Subsequent proceedings were unique and peculiar. Having in the order above cited denied the petition, thus holding the father legally entitled to the custody, without further hearing or testimony, in a decree entered December 16th, the court stated that the relator had expended at least $560 in maintaining the child, to the return of which she was equitably entitled, and thus changing a proceeding by habeas corpus to a suit in equity, proceeds to decree ‘•'■that the lawful *527custody of the child be awarded and decreed to be in the relator,” having thus decided the legal question both ways, declares the last title to be subject to defeasance and the right of the father to redeem within five days, by providing for the payment of the $560. I have not been able to find another case, either in law or equity, where an infant was by the decree of court taken from its father and pledged as security for its board bill. . ■
All the orders, decrees and proceedings in regard to the financial part of the case, being in excess of the jurisdiction, were void.
Only one other question remains to be determined, viz.: Who was legally entitled to the custody of the child ? The facts of the case are few and simple. Where there is a conflict in the testimony it is unimportant, and whether found one way or the other would not influence the decision; for instance, relator claims that the father agreed she should keep the child until he was 14 years old; this he denies and claims that it was for some indefinite period.
It is not claimed that the child was adopted and the parent divested of custody and control by a statutory proceeding. The title of the aunt was based on the wish of the mother and acquiescence of the father, and the fact that she had for about two years had the custody pursuant to such arrangement.
It was attempted to establish some kind of an agreement or contract as to some definite time, but the testimony was insufficient. Had it been to the extent claimed by the relator, j it would have been of no value and void for want of mutu-, ality. It will not be contended that the father could have' compelled the aunt to keep the child for any given time. ¡ She could at any time have delivered the child to the father, and he could at any time call for his child.
In this case the father and stepmother, as well as the aunt and uncle, appear to be eminently respectable and proper custodians, and of about equal pecuniary means, so the question of fitness is not involved. Where there is a ques*528tion of morality and fitness, or of poverty or affluence, courts are careful to consider the child’s welfare, and sometimes award it to a third party.
In nearly all the older cases, the controversy arose between the father and mother when separated.
The earliest leading case was decided by Lord Mansfield, known as Brissett's Case, reported 1 Lofft. 748, where it was said: “ The natural right is with the father, but if the father is a bankrupt * * * and if he be an improper person * * * the court will not think it right that the child should be with him.” To the same effect is Rex v. De Mandeville, 5 East, 220. This common law rule is followed in American courts, and the father, unless unfit by reason of immorality, is held entitled to the custody and control of his minor children. Nor is the rule departed from except in cases where the court finds it would be greatly to the welfare of the child that it should have some other custodian. See State v. Bird, supra; State v. Banks, supra; Wishard v. Medris, 34 Ind. 163; Mayne v. Baldwin, 5 N. J. Eq. 458; Armstrong v. Stone, 9 Gratt. (Va.) 102.
Sehouler in his work on Domestic Relations, 343, says: “The general doctrine appears to us, on the whole, to be this : that public policy is against the permanent transfer of the natural rights of a parent; and such contracts are not to be specifically enforced,” unless*by legal formalities as in the case of adoption and master and apprentice.
In State v. Baldwin, 5 N. J. Eq. 454, it said: “A verbal agreement by the father committing the child to the care.and custody of another until it should attain its majority, is void, and such child will be restored to its father upon a writ of habeas corpus. That the parents are the natural guardians and prima facie are entitled to the custody of their minor children.” •
The authorities almost universally agree that a parol agreement by the father, placing a child in the custody of another, is revocable at any time by the father, and that upon a habeas corpus proceeding, the child will be delivered to the fa.ther, *529unless considerations of the welfare of the child control. See also Church on Habeas Corpus, sec. 428; Child v. Dodd, 51 Ind. 484; Copeland v. The State, 60 Ind. 394; McGluman v. Margowski, 90 Ind. 150; Brooke v. Logan, 112 Ind. 183; State v. Clover, 16 N. J. Law, 419; In re Scarritt, 76 Mo. 565; De Jarnett v. Harper, 45 Mo. App. 415; Drumb v. Keen, 47 Iowa, 435.
It is alleged in the petition, and considerable stress is laid upon it in argument, that the father fraudulently induced the relator to bring the child to this city, and then in violation of his agreement, by force or stratagem, got possession of the child. The allegation is very weakly sustained by evidence.
It appears that relator was coming here on business, and the father in a letter to the husband of relator said: “ If she brings him to Denver to stay I will not take him from her,” and it is clearly inferable from the evidence that the principal business was to settle the custody of the child, and that she wished either to adopt him or surrender him upon the receipt of about $700, and failing to agree, the father took the child and carried it home. Admitting all that is claimed, it is a matter of no legal importance; having got the custody he could legally retain it.
Forsyth on The Custody of Infants, 65, says: “ That so long as the infant is not in the custody of the father, the court will, under certain circumstances, prevent him from obtaining possession of it, but if he has already got possession of the child, the court will not interfere to take it from him, at least unless there be apprehension of ill treatment or moral contamination by him.” See Foster v. Alston, 6 How. (Miss.) 406; Johnson v. Ferry, 34 Conn. 259.
It follows that the first order of the district court denying the petition was correct in the first paragraph, that the subsequent portion of the order and all subsequent orders and decrees were in excess of its jurisdiction and void, and must be reversed, and that the father (plaintiff in error) be declared to be entitled to the custody of the child.
jReversed.