Brooke and Elizabeth began their relationship in 2006 and announced their engagement the following year, even though same-sex marriage was not permitted in New York at the time and they did not have the resources to travel to a state where it was allowed.

In 2008, Elizabeth became pregnant with their child through artificial insemination. Though Brooke had no legal or biological ties to the child, a boy, she maintained a close relationship with him for years, cutting his umbilical cord at birth, giving him her last name and raising him jointly with Elizabeth.

In 2010, the couple ended their relationship, court papers said, and three years later, Elizabeth tried to cut off Brooke’s contact with the boy. Brooke sued for custody and visitation privileges, but was turned down by a lower court, which found the lawsuit “heartbreaking,” but ruled nonetheless that legal precedent under a New York case called the Matter of Alison D. v. Virginia M. did not define a nonadoptive, nonbiological caretaker as a parent.

In its ruling on Tuesday, the appeals court overturned that earlier case, writing that “the definition of ‘parent’ established by this court 25 years ago in Alison D. has become unworkable when applied to increasingly varied familial relationships.” It further held that “where a partner shows by clear and convincing evidence that the parties agreed to conceive a child and to raise the child together, the nonbiological, nonadoptive partner has standing to seek visitation and custody.”

More broadly, the court noted that “Alison D.’s foundational premise of heterosexual parenting and nonrecognition of same-sex couples is unsustainable,” particularly in light of New York’s law allowing gay marriage, which was passed in 2011, and the United States Supreme Court’s landmark ruling last year granting same-sex couples the right to marry.