ALBANY, N.Y. (AP) — New York’s highest court expanded the definition of parenthood Tuesday by ruling that former same-sex couples may seek visitation and custody of children even when they aren’t the biological or adoptive parent.

The Court of Appeals decision resolves two cases of former unmarried same-sex couples in which the biological mothers kept the children and their ex-partners sought legal standing to see them. In one case, lower courts ruled the ex-partner had no standing. In the other, the ex-partner pays child support and was later granted visitation.

A 25-year-old definition of parenthood required a person seeking custody or visitation to have a biological or adoptive connection to the child. In its decision, the court said the standard had become “unworkable” in light of society’s “increasingly varied familial relationships.”

“Where a partner shows by clear and convincing evidence that the parties agreed to conceive a child and to raise the child together, the non-biological, non-adoptive partner has standing to seek visitation and custody under Domestic Relations Law,” reads the opinion written by Judge Sheila Abdus-Salaam.

New York began recognizing same-sex marriages in 2011, and children born into a marriage are considered the children of both parents. But the law was far murkier when it came to same-sex couples who had a child before the law was enacted — or who have foregone marriage. Same-sex partners often found it impossible to seek visitation or custody of a non-biological child they had not adopted if the relationship ended.

“We have seen a trail of tears in New York involving these types of situations,” said Susan Sommer, senior counsel at Lambda Legal who worked on the case on behalf of one of the women seeking parental rights. “Until now, the court’s hands were tied. This allows a far more humane New York.”

The ruling will also apply to heterosexual, unmarried couples — meaning an ex-partner could petition for visitation or custody of a child created through artificial insemination if they can show they and their former partner intended to co-parent the child.

Sommer’s client, identified in the court papers by the name and initials Brooke S.B., began a relationship with her ex-partner in 2006 and the two soon planned to have a child through artificial insemination. In 2009, Brooke’s partner delivered a baby boy, who was given Brooke’s last name and raised jointly by the two women until 2010, when the relationship ended. Brooke was allowed to regularly see the child until 2013, when Brooke’s ex-partner ended the visits. Lower courts had ruled that Brooke had no right to custody or visitation because there was no biological or adoptive relationship.

In the other case, the two women agreed to have a child and raise her jointly before breaking up. The child remained with the birth mother while the two women filed legal actions over child support and visitation.

Christopher Chimeri, the attorney for the birth mother in the second case, said that while his client is personally disappointed, she accepts the decision.

© 2016, Associated Press, All Rights Reserved.

This material may not be published, broadcast, rewritten, or redistributed.