Callaghan, J.
This is a proceeding by way of a writ of habeas corpus by a mother for permission to see her children who have been duly adopted by the respondent. One’s natural impulses are in sympathy with the petitioner’s contention, but as I view the controlling authorities the relief asked here cannot be granted in a proceeding, of this nature. Section 70 of the Domestic Relations Law provides for proceedings by way of habeas corpus to procure custody of children when they are unlawfully restrained by one not entitled to their custody, hut it is obvious that that provision of the Domestic Relations Law does not apply to this situation. The respondent in this proceeding is entitled to the legal custody of the children and all natural rights of the parents have ceased. Matter of MacRea, 189 N. Y. 142. Therefore, the respondent *589would be in a position to maintain such a proceeding against the petitioner if the situation were reversed. A writ of habeas corpus is a common-law proceeding. It was under the common law “ a writ in behalf of liberty, and its purpose was to deliver a prisoner from unjust imprisonment and illegal and improper restraint.” People ex rel. Pruyne v. Walts, 122 N. Y. 238; People ex rel. Keator v. Moss, 6 App. Div. 414. The theory of such proceeding is, of course, that one is illegally restrained of his liberty as against one entitled to the custody. It is very true that habeas corpus may be resorted to for the purpose of determining the right of custody of children. The proceeding, however, is one of law and not in equity. When, therefore, one has the actual custody and the admitted legal right to the custody the court cannot, on habeas corpus, upon equitable principles, determine that the welfare of the child requires a temporary interference with such legal custody. It seems to me that an application for the relief here sought might be addressed to the equity side of the court, where the court would have full power, in its discretion, to do what is for the best interests of the children. That practice was followed in Matter of Knowack, 158 N. Y. 482; Wilcox v. Wilcox, 14 id. 576; Matter of Tierney, 128 App. Div. 835. And that such is the correct theory for such proceeding is strongly suggested in Matter of Stewart, 77 Misc. Rep. 524; People ex rel. Keator v. Moss, supra. It follows, therefore, that the writ must be dismissed and the children remanded to the custody of their foster parent, without prejudice, however, to any proceeding which the mother may bring for the relief sought herein.
Ordered accordingly.