*1391Appeal, by permission of the Appellate Division of the Supreme Court in the Fourth Judicial Department, from an order of the Family Court, Onondaga County (William J. Burke, J.H.O.), entered January 8, 2009 in a proceeding pursuant to Family Court Act article 5. The order directed respondent to submit to a genetic marker test.
It is hereby ordered that the order so appealed from is unanimously reversed on the law without costs and the matter is remitted to Family Court, Onondaga County, for further proceedings on the petition in accordance with the following memorandum: Petitioner commenced this paternity proceeding alleging that respondent is the father of one of her children and, at an appearance on the petition, respondent objected to genetic testing. His attorney quoted from Family Court Act § 532, which provides in relevant part that genetic testing shall not be ordered if the court finds that it is not in the best interests of the child to perform such testing, based on the presumption of legitimacy and equitable estoppel. It is undisputed that, at the time of the child’s birth, petitioner was married to someone other than respondent. In addition, respondent asserted that, from the time of the child’s birth until almost eight years later, when the petition was filed, petitioner and the child lived with a man other than respondent with whom the child had a parent-child relationship. Family Court implicitly denied the objection without a hearing by ordering a genetic marker test. That was error. Although Family Court Act § 532 (a) provides that a court shall order a genetic marker or DNA test “to aid in the determination of whether the alleged father is or is not the father of the child,” it further provides in relevant part that “[n]o such test shall be ordered, however, upon a written finding by the court that it is not in the best interests of the child on the basis of. . . equitable estoppel, or the presumption of legitimacy” (id.). “The courts ‘impose equitable estoppel to protect the status interests of a child in an already recognized and operative parent-child relationship’ ” (Matter of Shondel J. v Mark D., 7 NY3d 320, 327 [2006]; see Matter of Greg S. v Keri C., 38 AD3d 905 [2007]). In determining whether equitable estoppel should apply, “it is the child’s best interests that are of paramount concern” (Matter of Eugene F.G. v Darla D., 261 *1392AD2d 958, 958 [1999]; see Greg S., 38 AD3d at 905; Matter of Louise P. v Thomas R., 223 AD2d 592 [1996]).
Here, although the court ordered the test based on its belief that the child had a right to know the identity of his biological father, the court’s belief “is insufficient to overcome . . . the benefits accruing to the child by preserving his legitimacy” (Greg S., 38 AD3d at 906), as well as the parent-child relationship with petitioner’s paramour for many years. On this record, “[t]here was insufficient evidence before the court to determine the child’s best interests” (Eugene F.G., 261 AD2d at 959; see Louise P., 223 AD2d at 593). We thus conclude that, before ordering the genetic marker test, the court should have conducted a hearing to determine whether it was in the best interests of the child to do so, based both on equitable estoppel and the presumption of legitimacy (see Matter of Leon L. v Carole H., 210 AD2d 484, 484-485 [1994]). “If, and only if, the [court] determines that there should not be an estoppel [or application of the presumption of legitimacy] based upon the child’s best interests, then the [court] should order genetic marker or DNA tests and reach a determination thereon” (Matter of Darlene L.-B. v Claudio B., 27 AD3d 564, 565 [2006]). In addition, we agree with respondent that the court should have appointed an attorney for the child, as requested by respondent’s attorney, before conducting the hearing (see Matter of Troy D.B. v Jefferson County Dept. of Social Servs., 42 AD3d 964, 965 [2007]; Leon L., 210 AD2d at 484-485). We therefore reverse the order and remit the matter to Family Court for further proceedings on the petition consistent with this decision. Present—Smith, J.P, Centra, Fahey, Garni and Pine, JJ.