A lawyer seeking to free two chimpanzees from a state university has ​compared ​their legal fight to the struggle of enslaved blacks in the U.S.

'We had a history of that for hundreds of years saying black people are not part of society and you can enslave them. That wasn't right. It didn't work,' said Steven Wise, head of the Nonhuman Rights Project on Wednesday.

He extended the slavery comparison by saying that at one point in time courts didn't recognize Native Americans as 'legal persons' either.

Scroll down for video

Steven Wise, president of the Nonhuman Rights Project, compared ​the legal fight of two chimpanzees, Hercules and Leo, to the struggle of enslaved blacks and Native Americans in the U.S. on Wednesday

Hercules and Leo, the 8-year-old chimps, did not attend Wednesday's hearing. They are used for locomotion studies at Stony Brook University on Long Island (stock photo of chimp)

Wise 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, left, president of the Nonhuman Rights Project, and Assistant Attorney General Christopher Coulston, foreground right, talk after Wednesday's hearing in Manhattan State Supreme Court

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.

The case is being presided over by Judge Barbara Jaffe who thanked both sides for an 'extremely interesting and well argued' proceeding

'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.