By Daniel Wiessner

NEW YORK (Reuters) - An animal rights group has been granted a court hearing in which it will argue that two chimpanzees who live at a New York state university cannot be held captive because they are autonomous, intelligent creatures.

New York State Supreme Court Justice Barbara Jaffe in Manhattan issued an order late Monday, called a writ of habeas corpus, requiring the State University of New York at Stony Brook on Long Island to defend its right in court to keep the primates, Hercules and Leo. A writ of habeas corpus requires a person to be released from unlawful imprisonment.

In what it said was the first case of its kind in the world, the Nonhuman Rights Project claims that because chimpanzees are autonomous, intelligent creatures, their captivity amounts to unlawful imprisonment under the law. They want the pair of chimps, who are used in research on physical movement at the university, to be sent to a sanctuary in Florida.

Under the law, such orders can be granted only to "legal persons," so Jaffe would need to find that chimpanzees have at least some limited rights traditionally reserved for humans.

Jaffe did not explain the reason for issuing the order in Monday's brief decision.

The university did not immediately return a request for comment on Tuesday.

The hearing, in which the university will be represented by the New York state Attorney General's office, is scheduled for May 6.

In separate cases, the group, founded by Boston attorney and animal rights activist Steven Wise, sued the owners of two chimpanzees who live in upstate New York. State judges tossed out both lawsuits, and separate appeals courts upheld those rulings.

Wise has asked the state's top court, the Court of Appeals, to hear the cases. He has said a victory could spur similar cases on behalf of elephants, dolphins, whales and other intelligent animals.

In a more traditional animal welfare case in December, a judge in Argentina said an orangutan who lives at a zoo could be freed and transferred to a sanctuary.

The group behind that case made similar arguments to those presented by Wise, but the judge did not go so far as to grant the orangutan, Sandra, the rights reserved for humans.

The case is Nonhuman Rights Project v. Stanley, New York State Supreme Court, New York County, No. 152736-2015.