CONCORD, N.H. — The New Hampshire Supreme Court ruled Wednesday that the former partner of a 12-year-old girl’s mother has made her case to be considered a parent under the law.

The unanimous ruling makes New Hampshire the fourth state in the country to extend similar parental protections to same-sex parents, including a parent with no biological tie to the child.

The court ruled that the Uniform Parentage Act “is based on a person’s conduct, not a biological connection.”

The case pitted Madelyn B.’s birth mother, Melissa, against her former partner, Susan. Because it’s a custody case, no last names were used.

The pair split up when Madelyn was 6 but continued to co-parent until 2013, when Melissa cut off the relationship and moved to terminate Susan’s guardianship. Melissa also began proceedings to have her new husband adopt Madelyn.

The court noted that Susan’s presence in Madelyn’s life had been constant before Melissa moved to end it. The court ordered the family court in Derry to schedule a “prompt” hearing to set up Susan’s re-acquaintance with the daughter she hasn’t seen since March 2013.

“It’s a terrific opinion,” said Susan’s lawyer, Janson Wu, a senior staff attorney with Gay and Lesbian Advocates and Defenders. “It recognizes that a child has two parents regardless of their sexual orientation or the circumstance of the child’s birth.”

Wu said Susan did not want to comment.

Attorney Joshua Gordon, who represents Melissa, said his client has no avenue of appeal.

“The state Supreme Court is the end of the line for her,” Gordon said. He predicted the ruling will affect only a small number of couples, because gay marriage has been legal in New Hampshire since 2010.