CONCORD — The New Hampshire Supreme Court ruled Tuesday that the great-aunt of an infant can pursue guardianship of the child, overruling the Division of Children, Youth and Families, which claimed it had full legal custody of the child.

The unanimous ruling overturned a decision made in the Concord Family Court and returns the case to family court for a judge to consider the guardianship petition of the great aunt.

Her lawyer said the decision may have an impact on other cases where the DCYF has rejected guardianship efforts by relatives of abused or neglected children.

“We just want a shot to show the judicial system our client really wants to be involved and protect the interest of the child,” said Michael Lewis, a Concord lawyer involved in the case. “Our system shouldn’t be fighting that.”

Jake Leon, a spokesman for the agency that includes DCYF, said he could not provide a comment, since the ruling just came out on Tuesday. He referred a reporter to the Office of Attorney General John Formella, which did not reply to an email.

According to the ruling, the parents of B.C. are homeless and drug users; shortly after the baby’s birth, DCYF brought an abuse and neglect case against the parents.

A court awarded the agency “protective supervision” of the child, and DYCF placed the child in foster care.

Within days, the great-aunt filed papers for guardianship of the baby. The mother gave consent several days later.

Lewis said his client is a successful real estate executive in Illinois who temporarily moved to New Hampshire to help out and file for guardianship.

DCYF moved to dismiss the case, arguing it had a “legal relationship” with the child, and Circuit Court Judge Beth Leonard ruled that DCYF had “legal custody” and that state laws give DCYF priority over guardianship in such cases.

In a seven-page order, Justice Patrick Donovan ruled that state law allows for DCYF to retain legal custody of the child, but that does not stop a judge from appointing a guardian.

The guardian, however, could not modify or change custody orders, he wrote.

“If an individual or authorized agency other than the guardian has ‘legal custody’ of the child, the guardian has no authority to remove the child from his or her home, foster home, or other residential placement,” he wrote.

Lewis said his client will return to court to seek guardianship.