NEW YORK—Two chimpanzees will not be freed from a New York state university where they’re used in locomotion studies after a court decision Thursday dismissed a lawsuit that had sought to afford them legal personhood rights.

While the Nonhuman Rights Project had standing to bring the lawsuit on behalf of 8-year-old chimpanzees Hercules and Leo, a higher court decision last year that found a chimpanzee named Tommy was property, not a person, necessitated the lawsuit be tossed, State Supreme Court Justice Barbara Jaffe wrote in her decision.

“Efforts to extend legal rights to chimpanzees are thus understandable; some day they may even succeed,” she wrote in a 33-page decision. “For now, however, given the precedent to which I am bound, it is hereby ordered, that the petition for a writ of habeas corpus is denied and the proceeding is dismissed.”

A representative for the Nonhuman Rights Project didn’t immediately return a request for comment.

In May, a lawyer for the group argued before a packed Manhattan courtroom that Hercules and Leo should be removed from the Stony Brook University on Long Island to a sanctuary in Florida.

Attorney Steven Wise said then that chimpanzees, which are biologically similar to humans, are “autonomous and self-determining beings” and thus deserve similar legal rights. He likened their confinement at the university to slavery, the involuntary detention of people with mental illnesses and imprisonment.

But an assistant attorney general, representing the state university system, argued that not only was the venue improper, but that chimpanzees were not entitled to legal personhood rights because they could not fulfil the responsibilities of people in society.

Wise filed hundreds of pages of expert opinions from academics, zoologists, biologists and others he said supported the claim that cognitively, chimpanzees — along with dolphins, bonobos, orangutans and elephants — are advanced species.