The relator obtained a writ of habeas corpus returnable before a justice of this court," requiring the appellant to produce before the justice granting the writ the relator’s two children in the custody of the appellant. In response to that writ the appellant produced the two children and made a return, wherein it was alleged that in August, 1893, the said relator obtained a writ of habeas corpus in the Superior Court requiring the production of such children; that subsequently the respondent (the appellant in this proceeding) filed his return to such writ; that thereafter such proceedings were taken that, on the 29th day of August, 1893, an order was made in such proceedings referring the matters to a referee to take proof and examine on oath the parties thereto, and such other witnesses as, either party might produce; that, on the 14th day of October, 1893, the said referee duly made and filed his report; that, on November 23, 1893, said Superior Court, after hearing the respective parties, dismissed the writ and awarded the care, custody and control of the said children named to the respondent (the appellant in this proceeding), and it was further alleged in such return that such order was a formal and binding adjudication and judgment of the court in respect to the matters and things alleged in the proceeding, upon which the custody of the said children is sought. A copy of that order appears in the record. As a traverse to this return the relator did not deny the institution of such proceedings and the making of such order, but merely denied each and every allegation in the return, setting forth, or tending to set forth, that he is unfit to have the custody of the children in the proceeding herein prayed for, and alleged that the appellant is unfit to have and retain the custody of said children. Upon the return to this writ the relator produced and submitted to the justice the record of such proceedings in the Superior Court and such order so set forth in the return. The appellant moved to dismiss the writ, and that motion the court apparently denied. The court proceeded to take the testimony of the witnesses produced, and subsequently entered an order directing that further proof be produced by the parties before a referee named in the order. No formal order was entered denying the appellant’s motion to dismiss the proceedings, and the appeal is from the order directing a reference to take the testimony of the parties.
We think that it was the duty of the justice before whom - the *421proceedings were had to dismiss the writ. By section 2031 of the Code it is provided that the court or judge before which or whom a prisoner is brought by virtue of a writ of habeas corpus, issued as prescribed in the article, must, immediately after the return of the wilt, examine into the facts alleged in the return, and into the cause of the imprisonment or restraint of the prisoner. By section 2032 of the Code it is provided that “ the court or judge must forthwith make a final order to remand the prisoner if it appears that he is detained in custody for either of the following causes: * * * (2) By virtue of the final judgment or decree of a competent tribunal of civil or criminal jurisdiction, or the final order of such a tribunal, made in a special proceeding, instituted for any cause, except to punish him for a contempt.” By the return to this writ it appeared that the children were in the custody of the appellant by virtue of a final order of the Superior Court made in a special proceeding, and by the traverse to that return that allegation is not denied. Ho fact is alleged, either in the petition for the writ or in the traverse to the return, by which it is shown that the relator was entitled to the discharge of the persons detained, or to the custody of these children by virtue of any of the provisions contained in section 2033 of tjie Code. By section 2034 of the Code it is provided : “ But a court or judge, upon the return of a writ issued as prescribed in this article, shall not inquire into the legality or justice of any mandate, judgment, decree, or final order, specified in the last section but one, except as therein stated.” The learned justice before whom this proceeding was pending was, therefore, expressly precluded from inquiring into the justice or legality of this final order of the Superior Court in the proceeding awarding the custody of these children to the appellant. The children were not illegally deprived of their liberty, but were in the custody of the appellant under the order of a court of compétent jurisdiction ; and no fact having been alleged to show that, in consequence of any event which had happened since the entry of that order, the relator was entitled to • the discharge of these children, or to have their custody awarded to him, the learned justice was bound to dismiss the proceeding.
It is well settled that a final order upon a writ of habeas corpus is a final ad judication binding upon the parties, and is upon a subsequent application for the same .purpose res ad judicata. (Matter of Price, *42212 Hun, 508; 9 Am. & Eng. Ency. of Law, 238, and cases cited; Mercein v. People ex rel. Barry, 25 Wend. 64.) And when it appears upon a return to the writ that the person in custody is held, under an order or judgment granted by a court of competent jurisdiction, unreversed and in full force, under the express provisions of the Code as well as upon the principle of ves adyudieata,, the court is bound to dismiss the writ, unless subdivision 2 of section 2033 of the Code is shown to apply, which provides that “ where, although the original imprisonment was lawful, yet by some act, omission, or event, which has taken place afterwards, the prisoner has become entitled to be discharged.”
By virtue of this writ of habeas corpus, upon a petition addressed to the Supreme Court, these children were . produced in court. Upon such production of the children the relator asked the court to award their custody to him. That application was not made under the statute allowing a writ of habeas corpus to be granted ; the writ had expended its force when the children were produced in court, but the relator then asked the Supreme Court, as the court which had succeeded to the power of the Court of Chancery, and thus had jurisdiction over minors, to award him the custody of the children. That motion was met by the production of this record, by which it was adjudged that the respondent was entitled to such custody. And before the Supreme Court, in the exercise of its jurisdiction, can reverse or supersede this order by which the custody of the children was awarded to the appellant, the relator, must allege and prove that, in consequence of some changed condition which affected the right of the custody of the children;, it is now for their interest that their .custody should be awarded to him. The allegation in the traverse to the return to the writ is a general allegation that the appellant is not a fit and proper person to have the custody of the children. This is identically the issue presented to the Superior Court upon the former hearing and there adjudged against him. To entitle 'the relator to reopen that question and retry that issue, the allegation must be plain and distinct that it is a new issue to be tried, not the old one, and that this appellant since the former adjudication has become unfit to retain the custody of the children. Ho such allegation was made here, and .so far as appears no such claim has been made. What this relator wishes to do is to have the *423question determined by the order of the Superior Court retried before another tribunal, which he hopes to persuade to come to a different conclusion. The orderly administration of justice requires that such an attempt should not be allowed to succeed even so far as. to undertake the investigation.
TTo order, however, was entered by the justice before whom these proceedings were had upon this motion to dismiss. The order that was entered and from which the appeal is taken, was an interlocu-. tory order directing that further testimony be taken before a referee. The order, however, was not an order of the justice, but an order of the court entered as a court order. The petition was addressed to the Supreme Court, not to a justice thereof, and the prayer of the petitioner was that the court would grant a writ of habeas corpus, directed to the respondent, commanding him to bring up the said children to abide such order as the court might direct. The proceeding was instituted to obtain an order from the court, as a successor to the Court of Chancery, awarding the custody of the children to him, the writ of habeas corpus being used merely to bring the children before the court and place them in the custody of the court that the court could act upon the application. In a technical sense, there was no evidence that these children were restrained of their liberty. They were in the custody of the appellant, he supporting and maintaining them.
The nature of these proceedings upon the return of such writ is discussed by the chancellor and other justices of the Court of Errors in the case of Mercein v. The People ex rel. Barry (25 Wend. 94), where-it was held that such a writ of habeas corpus and such a proceeding-for the custody of the children were before the court, not before the chancellor out of court; that the order of the chancellor awarding the custody of the children to the mother was properly entered with the register of the court and became a matter of record,- that such an order having been once entered was a binding adjudication upon the parties and could not be. called in question in a subsequent proceeding, and that the court on a new proceeding was bound to follow that order or adjudication, unless new facts were alleged which had occurred subsequent to the decision on the former writ which had altered the state of the case, or the relative claims of the parents to the.custody of the children, in a material aspect. This, then, being *424an application to the court for the exercise of the jurisdiction vested in it as the successor to the Court' of Chancery for the custody of these, children, the appellant was upon the record entitled to an order upon the former adjudication, that he was entitled to the custody of the children; and where the court refused to enter such an order to which the appellant was entitled, hut directed a reference to take proof of the facts produced in support of the petition, the question is whether or not such an order is appealable.
It is claimed by the relator here that.we should dismiss this appeal under section 2058 of the Code, by which an appeal is restricted to a final order made upon the return of such writ to discharge or remand a prisoner, or dismiss the proceeding, and Matter of Larson (96 N. Y. 382) is cited in support of this construction of the Code. This provision of the Code, however, relates strictly and solely to writs of habeas corpus and the proceeding thereon. In that case the question presented was on an appeal from an order by which a justice of the court at Special Term had required the respondent to the writ -to make a further return, and the Court of Appeals held that the order requiring such further return was not appealable to the General Term. In this casé the one proceeding which was before the court was as to the return that should be made to the writ of habeas corpus. Ho motion was then pending addressed to the court upon a subject entirely distinct from the production of the persons alleged to have been illegally detained. The question came as to the return to the writ. In the case at bar a return had been made. The children were before the court, and the relator then asked the court to award to him the custody of the children. We have thus a new proceeding commenced in which the powers of the' Supreme Court, as a successor to the Court of Chancery, are invoked to give to this relator substantial relief. Upon the record the appellant moves to dismiss the writ. To an order dismissing the writ he was entitled, and on that motion the court, instead of passing upon that question, appoints a referee to take testimony, not upon the return to the writ of habeas corpus as to the detention of the persons alleged to be illegally detained, but to take testimony as to whether or not the court, in the exercise of its power, shall award the custody of these children to the relator. We think this order is appealable, not under the sections of the Code regulating the pro*425ceeding upon a writ of habeas corpus, but under the general power vested in this court to review all orders affecting a substantial right or involving some part of the merits in either an action or special proceeding made at a Special Term or Trial Term of the Supreme Court. (Code, § 1347.)
We have had occasion lately to examine this question as to the appealability of orders in special proceedings as in the Matter of Manhattan Railway v. O’Sullivan (post, p. 571), and upon the principles stated in that case it is clear that any order made upon this application to the Supreme Court which involved a substantial right was appealable, not as an order made in a habeas corpus proceeding, but as an order made in the matter of the application of this relator for the custody of these children. It is clear that this order affects a substantial right. Under it this appellant will be compelled to again produce to the referee his evidence as to the question of the custody of these children, a question which has once been adjudicated in his favor. The expense of that proceeding he must bear, and we think it was his right to have had an order then entered dismissing the proceeding and not compelling him again to litigate a question which a binding adjudication has settled in his favor.
We think, therefore, that the order appealed from should be reversed and an order entered dismissing the proceeding, with costs.
Barrett, J., concurred.
Appeal dismissed, with costs.