It took 25 years, but on Tuesday New York State’s highest court finally admitted the damage it did in 1991 with a ruling that denied parental rights to many people in nontraditional families — including unmarried opposite-sex couples, stepparents, and gays and lesbians — who are raising children.

In an opinion that recognizes the rapidly expanding rights of same-sex couples in particular, the Court of Appeals overturned what it called a “needlessly narrow” ruling, which held that a person in an unmarried relationship could be considered a parent to a child in that relationship — and thus be able to seek custody or visitation rights — only if he or she was the biological parent or had adopted the child.

Under the 1991 decision, gays and lesbians, who were forbidden by law to marry in New York until 2011 and forbidden to adopt until 1995, could spend years helping their partners rear a child and yet have no legal rights.

That’s what happened to Brooke S.B., a petitioner in the current case, whose partner, Elizabeth A. C.C., had borne a boy whom they raised together, who was given Brooke’s last name and called her “Mama B.” When the couple’s relationship ended in 2010, Elizabeth sought to block Brooke from having contact with the boy. The courts ruled against Brooke, because the 1991 decision, Alison D. v. Virginia M., meant she had no legal standing as a parent.