A lawyer seeking to free two chimpanzees from a state university told a judge Wednesday that their confinement for research purposes is akin to slavery, the involuntary detention of mentally ill people and imprisonment.

Steven Wise, an attorney with the Nonhuman Rights Project, told Manhattan Supreme Court Judge Barbara Jaffe in a nearly two-hour hearing that Hercules and Leo are "autonomous and self-determining beings" who should be granted a writ of habeas corpus and be moved from Stony Brook University on Long Island to a sanctuary in Florida.

"They're essentially in solitary confinement," Wise told the judge before a crowd of about 100 people packed into the Manhattan courthouse's ceremonial courtroom. "This is what we do to the worst human criminal."

The 8-year-old chimps, who did not attend the hearing, are used for locomotion studies at Stony Brook.

Christopher Coulston, an assistant state attorney general representing the university, argued that the case was meritless on procedural grounds because the venue was improper and because granting the chimps personhood would create a slippery slope regarding the rights of other animals.

Much of the proceeding focused on centuries-old legal principles including the social contract, the writ of habeas corpus and the equal protection of laws.

Wise repeatedly cited legal decisions that granted the writ of habeas corpus to groups historically denied it -- including to Native Americans and blacks during the 1800s.

Coulston said that it was improper for a court to decide whether the animals are entitled to a writ of habeas corpus and that doing so would be unprecedented, telling Jaffe it is up to the legislature to define personhood in this case.

"The reality is these are fundamentally different species," he said. "There's simply no precedent anywhere of an animal getting the same rights as a human."

He also argued that removing the chimps from Stony Brook and sending them to an island sanctuary is essentially trading one type of confinement for another, further complicating the law.

"They have no ability to partake in human society, the society that has developed these rights," he said.

Wise pointed to a hundred pages of affidavits by legal and scientific experts that he says support his claim that chimpanzees are cognitively advanced beings that -- not unlike elephants, dolphins, bonobos and orangutans -- should be granted personhood status under the law in cases of confinement.

The rights project has filed similar cases before. In October, an attorney with the group argued before a state appeals court over Tommy, a 26-year-old chimp in upstate Fulton County. The court ruled against the group.

Two other cases are pending in state court.

Jaffe didn't make a ruling but thanked both sides for an "extremely interesting and well argued" proceeding.