
757 N.W.2d 360 (2008)
276 Neb. 765
BRETT M., also known as Morgan V., a minor child, ex rel. NEBRASKA CHILDREN'S HOME SOCIETY, a Nebraska nonprofit corporation, Appellee,
v.
Jason VESELY and Angela Vesely, Husband and wife, Appellants.
No. S-08-178.
Supreme Court of Nebraska.
November 21, 2008.
*361 Kathleen Koenig Rockey and Christopher C. Hilkemann, of Copple, Rockey & McKeever, P.C., L.L.O., Norfolk, and Kelly N. Tollefsen, Lincoln, for appellants.
Tom D. Hockabout, of Moyer, Egley, Fullner & Montag, Madison, for appellee.
Jeffrey M. Doerr, of Law Offices of Jeffrey M. Doerr, P.C., Neligh, guardian ad litem.
*362 HEAVICAN, C.J., WRIGHT, CONNOLLY, GERRARD, STEPHAN, McCORMACK, and MILLER-LERMAN, JJ.
MILLER-LERMAN, J.

NATURE OF THE CASE
This case involves an appeal from the issuance of a writ of habeas corpus by the district court for Knox County ordering the removal of Brett M., also known as Morgan V. (Morgan), from the home of his prospective adoptive parents, appellants Jason Vesely and Angela Vesely, where he had been placed by appellee, Nebraska Children's Home Society (the agency). We conclude that although legal custody of Morgan remained with the agency, Morgan was not being illegally detained by the Veselys and that it is in the best interests of Morgan to remain with the Veselys. We reverse the issuance of the writ.

STATEMENT OF FACTS
The Veselys were the prospective adoptive parents of Morgan, who was placed in their home by the agency in anticipation of an agency adoption. The record shows that since 2003, the Veselys have lost three children, due to complications as the result of premature births, and have experienced a miscarriage and failed fertility treatments. In 2005, the Veselys contacted the agency to inquire about adoption. After contacting the agency, the Veselys attended the agency's "information sharing meeting," which the agency describes as the first step for any eligible adoptive couple. After this meeting, the Veselys expressed interest in continuing with the process to become adoptive parents.
On February 2 and 3, 2006, the Veselys attended the agency's training class for prospective adoptive parents. During this class, the agency covers issues raised by adoption, infertility, and pursuing fertility treatments. At the training, the agency advises couples that changes in their lives, including pregnancy status, that could impact the placement of a child should be reported.
After completion of the training class, the next step in the adoptive process is a home study. The Veselys' home study was completed on December 29, 2006, by the couple's caseworker, who testified that it was her usual practice to inform parents of the necessity to keep the agency advised of any changes in their circumstances.
Upon completion of a successful home study, prospective adoptive couples are provided with an approval letter informing them that they are being placed on the waiting list for placement of a child. The Veselys received their letter on February 9, 2007. The following July, Angela Vesely became pregnant through the process of in vitro fertilization.
On November 1, 2007, the Veselys were contacted by the agency and informed that the agency had a child waiting in North Platte, Nebraska, to be adopted, and that the birth mother had selected the Veselys' profile for placement of the child. The child, Morgan, was born on October 29, 2007. On November 2, the Veselys drove to North Platte and met with the birth mother. The birth mother's parents were also present. The Veselys stated that at no time during this 2-hour meeting were they asked about their pregnancy status. After meeting with the Veselys, the birth mother signed relinquishment papers irrevocably relinquishing custody of Morgan to the agency. The birth mother indicated her wish to place Morgan with the Veselys. On that same day, the Veselys left the hospital with Morgan and brought him to their home in Verdigre, Nebraska.
On November 7, 2007, the agency executed a "Confirmation of Placement" stating *363 that the child was placed with the Veselys for the purpose of adoption. The confirmation of placement authorized the Veselys to give permission for medical and surgical care needed for Morgan and provided that as of November 2, "the adoptive parents assume full responsibility for this child."
On December 3, 2007, through a Medicaid application for Morgan, the agency became aware that Angela Vesely was pregnant. Upon learning about the pregnancy, a representative of the agency contacted Jason Vesely and inquired about the pregnancy. Jason Vesely informed the agency that because of the problems they had experienced with prior births, the Veselys were waiting to tell Morgan's birth mother about the pregnancy until after Christmas, when, according to Jason Vesely, they would feel more secure that the pregnancy would be successful.
On December 10, 2007, a representative of the agency met with the birth mother and her mother and advised them that Angela Vesely was pregnant. On December 12, representatives of the agency, including the director, met with the Veselys and advised them that the agency intended to revoke the placement. The director instructed the Veselys to return Morgan to the agency on December 14, citing as reasons the Veselys' failure to disclose their pregnancy status, the birth mother's being upset about the pregnancy, and the concern for potential bonding issues. The Veselys protested and informed the staff of the agency that they loved Morgan and would take whatever steps were necessary to keep Morgan in their home. On December 14, the agency formally revoked the confirmation of placement by executing a "Confirmation of Revocation of Placement."
The Veselys did not return Morgan to the agency, and on December 14, 2007, filed in the county court for Knox County a petition for appointment as guardians on behalf of Morgan. On December 30, Angela Vesely gave birth to a son, who was born prematurely at 28 weeks.
On January 28, 2008, the agency filed a petition for a writ of habeas corpus, asking that the district court order the Veselys to return Morgan to the custody of the agency. It is this habeas corpus action which gives rise to the instant appeal. The district court held a hearing on the petition for habeas corpus on February 11. At the hearing, the court heard testimony from Morgan's nurse practitioner, who visited the Veselys and observed them with Morgan on November 13, 2007. She testified that she observed good interaction between the Veselys and Morgan, that Morgan moved his head toward their voices, that there was a good rapport between the Veselys and Morgan, and that Morgan was cooing at the Veselys. She further opined that the Veselys and Morgan were beginning the bonding process. Morgan's physician testified that there was a good rapport between Jason Vesely and Morgan. The physician also testified that bonding between the child and parents could occur very quickly. There was also testimony at the hearing indicating that the Veselys had support from extended family, many of whom were available to help care for Morgan.
The court also heard testimony from the parties with respect to what information the Veselys received regarding the advisability of informing the agency of their pregnancy status. The agency also introduced into evidence the birth mother's placement profile, which indicated that she wanted her son placed in a home with a stay-at-home mother and wanted him to be an only child.
On February 15, 2008, the district court entered an order concluding that the agency *364 had legal custody of Morgan; that the agency revocation of placement was valid; and that it was in the child's best interests that his care, custody, and control be returned to the agency. The court found that the Veselys had provided Morgan with all the necessary care, support, and love and that based on the testimony of the medical professionals, Morgan had thrived. Nevertheless, the court concluded that other factors supported a decision to return the child to the agency. These factors included the court's determination that the Veselys should have reported their pregnancy status to the agency; the court's determination that the birth mother selected the Veselys based on a profile that Morgan would have an at-home mother and would be an only child, and that therefore, Angela Vesely's pregnancy changed the "spirit" of the adoption; and the court's concern that there was likely to be prolonged litigation in this case. This order is the subject of this appeal.
After this ruling, the parties seem to agree that Morgan was returned to the agency and placed with his maternal grandparents. The record does not contain detailed information concerning the maternal grandparents' home environment. The district court's order states that there is nothing in the record to indicate that the placement with the maternal grandparents would not be in the best interests of Morgan or in his welfare or that the prospective placement would not provide Morgan with care and love. The district court issued a writ of habeas corpus directing the Veselys to deliver Morgan to the agency. The Veselys appeal.

ASSIGNMENTS OF ERROR
The Veselys claim that the district court erred (1) by finding that Morgan was illegally detained by the Veselys and (2) by determining that it was in Morgan's best interests to be returned to the agency.

STANDARD OF REVIEW
A decision in a habeas corpus case involving custody of a child is reviewed by an appellate court de novo on the record. Gomez v. Savage, 254 Neb. 836, 580 N.W.2d 523 (1998).

ANALYSIS
In this case, we are concerned with a habeas corpus action involving the custody of a child in the context of an agency adoption. Therefore, our consideration of this appeal is made by reference to the jurisprudence surrounding habeas corpus actions involving detention of a child and the law regarding agency adoptions. With respect to the latter, we note that the Legislature, as well as this court, has long recognized a distinction between agency adoptions and private adoptions. Yopp v. Batt, 237 Neb. 779, 467 N.W.2d 868 (1991). With respect to habeas corpus, we have said that ordinarily, the basis for the issuance of a writ of habeas corpus is an illegal detention, but in the case of a writ sued out for the detention of a child, the law is concerned not so much about the illegality of the detention as about the welfare of the child. Christopherson v. Christopherson, 177 Neb. 414, 129 N.W.2d 113 (1964).

Although the Agency Retained Legal Custody of Morgan, the Veselys Did Not Illegally Detain Him.
The Veselys appeal from the district court's issuance of a writ of habeas corpus ordering the removal of the minor child, Morgan, from their home. In determining the validity of the issuance of the writ of habeas corpus, we must first determine which party had legal custody of Morgan and, thereafter, determine whether Morgan was being illegally detained by *365 another party. Because this case involves a child placement agency, we are guided initially by statute. In an agency adoption, under Neb.Rev.Stat. § 43-106.01 (Reissue 2004), the rights of a parent who has relinquished in writing his or her child are terminated when the agency accepts responsibility for the child in writing. It is the agency that finds and investigates the prospective parents. Gomez v. Savage, supra. We have stated that "[i]f the adoptive parents are unsuitable or decline to go through with the adoption, the agency retains custody over the child...." Id. at 846, 580 N.W.2d at 531. It has also been observed that
[w]here a licensed child placement agency places a child with prospective adoptive parents for the purpose of adoption, it cannot arbitrarily and unreasonably terminate that placement merely by asserting and proving that it is still the legal guardian.... [T]here must be also some evidence of reasonable grounds for terminating a placement for adoption by a licensed placement agency in this state.
Nebraska Children's Home Soc. v. Collins, 195 Neb. 531, 538-39, 239 N.W.2d 258, 262 (1976) (McCown, J., concurring).
In this case, the evidence shows that the agency retained legal custody of Morgan. Pursuant to § 43-106.01, the birth mother relinquished her parental rights to the agency in writing and the agency accepted responsibility for Morgan in writing. Neb. Rev.Stat. § 43-109(1)(a) (Reissue 2004) requires that a child reside with the prospective adoptive parents for a minimum of 6 months before the prospective adoptive parents can become eligible to adopt the child. Because Morgan had not resided with the Veselys for 6 months when the agency sought to revoke the placement and filed this habeas corpus action, no formal adoption proceedings had yet been undertaken.
The Veselys assert that they retained "legal" custody of Morgan because the agency arbitrarily revoked the placement of Morgan. While we agree with the assertion that an agency must have a proper basis for revoking a prospective adoptive placement, we do not agree with the Veselys that an improper revocation controls the issue of the legal custody of Morgan.
The district court correctly concluded that the agency retained legal custody of Morgan. This is so because the birth mother had relinquished her parental rights in writing, the agency accepted responsibility for the child in writing, and formal adoption proceedings had not been completed. However, the district court also found that by virtue of the revocation, the Veselys' rights to physical custody for placement purposes had been properly terminated by the agency and that the Veselys were therefore illegally detaining Morgan. We disagree with this determination.
In reaching our conclusion, we have considered but rejected the agency's argument that because of its status as legal custodian and the Veselys' failure to report their pregnancy status, revocation of the placement was justified. An adoption agency cannot arbitrarily or unreasonably terminate a placement merely by asserting that it is still the legal guardian of the child. Nebraska Children's Home v. Collins, supra. As the Veselys point out, the parties entered into an agreement titled "Client Rights and Responsibilities," and nowhere in this agreement does it state that the Veselys were required to inform the agency of their pregnancy status. The parties did not enter into any written agreement specifically stating that the Veselys would forfeit their rights to adopt Morgan if Angela Vesely became pregnant *366 or if she were pregnant at the time Morgan was placed with them. Absent any such written agreement or policy, we do not believe that the Veselys' failure to disclose their pregnancy status was a reasonable ground to terminate the placement for adoption with the Veselys. Contrary to the district court's determination, the Veselys were not illegally detaining Morgan.

It Was in the Best Interests of Morgan to Remain With the Veselys.
To determine the best interests of Morgan, we next review the record as of the time the district court ruled. When determining the best interests of a child, we review the record before the district court de novo. Gomez v. Savage, 254 Neb. 836, 580 N.W.2d 523 (1998). As we have noted above, in the case of a writ served out for the detention of a child, the law is concerned not so much with the illegality of the detention as about the welfare of the child. Christopherson v. Christopherson, 177 Neb. 414, 129 N.W.2d 113 (1964).
The Veselys argue that the district court erred in its best interests analysis when it determined that although Morgan was thriving in the care of the Veselys, the revocation of the placement and his removal was nevertheless warranted based on considerations such as the "spirit" of the adoption, the wishes of the biological mother, the possibility of future litigation, and the effect of the Veselys' minor child on Morgan's welfare. The Veselys generally argue that it was in Morgan's best interests to remain with them. The Veselys specifically contend that by applying the best interests criteria set forth in Nebraska custody cases involving divorcing parents, it was not in Morgan's best interests to be returned to the agency. See, e.g., McDougall v. McDougall, 236 Neb. 873, 464 N.W.2d 189 (1991) (reciting best interests factors used in dissolution cases).
Although relevant, we are not persuaded that the best interests factors examined in custody cases between divorcing parents are the most appropriate criteria to a determination of best interests in the current context. Rather, in determining whether the best interests of the child are served by continued placement with prospective adoptive parents, we believe it is appropriate to consider factors that have been used in similar placement cases elsewhere. These factors include, but are not limited to, the prospective adoptive parents' ability to provide for the child's emotional and intellectual development, the quality of the prospective adoptive parents' home environment, the length of placement of the child, and the financial ability of the prospective adoptive parents to provide for the child. See, e.g., In re Summer A., 49 A.D.3d 722, 854 N.Y.S.2d 195 (2008); In re Baby Boy M., 269 A.D.2d 450, 703 N.Y.S.2d 221 (2000). Indeed, these factors are consistent with considerations we have applied in juvenile cases where we have reviewed whether removal of the child or termination of parental rights is in the child's best interests. In those cases, we have considered whether a parent has the insight and motivation to protect his or her child, the length of time the child has remained away from the parent, and the parent's capacity and desire to be an active parent. See, e.g., In re DeWayne G. & Devon G., 263 Neb. 43, 638 N.W.2d 510 (2002); In re Joshua M. et al., 251 Neb. 614, 558 N.W.2d 548 (1997); In re Interest of B.B. et al., 239 Neb. 952, 479 N.W.2d 787 (1992). We logically apply these considerations to the Veselys as prospective adoptive parents in this habeas corpus proceeding.
With respect to the factors set forth above, we note that the agency did not argue in the district court, or on appeal, that the Veselys were unsuited to serve as *367 parents. Importantly, on the record presented, the district court effectively found the Veselys to be suitable. In its order, the district court stated:
This court specifically finds that since the date Morgan was placed with [the Veselys] on November 2, 2007, they have provided all of the necessary care, support and love for [Morgan] in their home which is appropriate for that purpose. The [Veselys'] immediate family has shared in said efforts and ha[s] also provided nurturing to Morgan. In response to these efforts, it is undisputed, and the court so finds, that Morgan has thrived as demonstrated by the testimony of the medical professionals, as well as other family members. The court further finds that the [Veselys] truly love Morgan and have every intention to provide for all of his needs in the future.
Our de novo review of the record shows that the district court's findings are well supported. There was testimony at the hearing by Morgan's nurse practitioner that she observed good interaction and a good rapport between the Veselys and Morgan and that the Veselys and Morgan were in the beginning stages of bonding. Morgan's physician also testified that there was good rapport between Morgan and Jason Vesely. There was evidence that the Veselys had support from their extended family. There was no evidence at the hearing to suggest that Morgan's needs were not being met by the Veselys, that the home environment was unsuitable, or that the Veselys could not financially take care of Morgan.
Based on our de novo review of the record made before the district court, and applying the considerations discussed above, we determine that it was in the best interests of Morgan to remain with the Veselys, that the district court's ruling to the contrary at the time it was made was erroneous, and that its order issuing the writ must be reversed.

CONCLUSION
Our de novo review of the record made at the district court establishes that Morgan was not being illegally detained by the Veselys and that it is in the best interests of the minor child, Morgan, to remain in the care of the Veselys. Accordingly, we reverse the order of the district court which issued the writ of habeas corpus and we hereby order that Morgan be returned to the Veselys, pending the initiation and resolution of adoption proceedings.
REVERSED WITH DIRECTIONS.
