New Hampshire Supreme Court has unanimously sided with the ex-partner of a 12-year-old girl’s biological mother in a custody case, making the ex-partner a parent under law.

The ruling came on Wednesday, making New Hampshire the fourth state in the US to extend parental protections to same-sex parents, regardless of whether they have a biological connection to the child.

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

Birth mother Melissa separated from ex-partner Susan when the child in question, Madelyn B., was 6-years-old. The pair co-parented Madelyn until 2013, when Melissa made moves to terminate Susan’s guardianship and have her new husband adopt Madelyn.

Madelyn was born in 2002, which was before civil unions or same-sex marriages were recognized by the state.

The ruling noted Susan’s extensive role in the child’s life, from birth announcements naming both Susan and Melissa as parents to Susan’s role in decisions made on how Madelyn would be raised.

In April 2013, a family court suspended Susan’s guardianship and barred her from intervening in adoption proceedings at Melissa’s request. Now that the family judge’s orders have been vacated by the state Supreme Court, the case will be sent back for a new hearing.

The family court was ordered to schedule a prompt hearing as Susan has not seen Madelyn since March 2013.