An orangutan that has lived 20 years at the Buenos Aires zoo is entitled to some legal rights enjoyed by humans, an Argentine court has ruled, a decision the ape's attorney called unprecedented and a ticket to greater freedom.

The ruling comes a month after a local animal rights group filed a habeas corpus writ in favor of Sandra, who was born in Germany but has lived im captivity in Buenos Aires most of her life.

From this ruling forward ... the discussion will be whether captivity in itself damages their rights. Andres Gil Dominguez, lawyer

"Following a dynamic ... judicial interpretation, it is necessary to recognise that the animal is subject to rights, and should be protected," said the December 18 ruling, published on Monday by the official judicial news agency and reported by the Associated Press news agency.

Andres Gil Dominguez, who represented the orangutan, said the "unprecedented" ruling paves the way for the habeas corpus rights to be accepted by the courts and for Sandra to be released at a sanctuary.

"It sets a precedent that changes the paradigm of animal guardianship and will impact their rights. ... It will lead to a lot of discussions," Gil Dominguez told The Associated Press.

"From this ruling forward ... the discussion will be whether captivity in itself damages their rights."

New York case

Earlier this month, a New York appeals court ruled that a chimpanzee is not entitled to the rights of a human and does not have to be freed by its owner.

The three-judge Appellate Division panel was unanimous in denying "legal personhood'" to Tommy, who lives alone in a cage in upstate Fulton County.

A trial-level court had previously denied the Nonhuman Rights Project's effort to have Tommy released. The group's lawyer, Steven Wise, told the appeals court in October that the chimp's living conditions are akin to a person in unlawful solitary confinement.

Wise argued that animals with human qualities, such as chimps, deserve basic rights, including freedom from imprisonment. He has also sought the release of three other chimps in New York and said he plans similar cases in other states.

But the mid-level appeals court said there is neither precedent nor legal basis for treating animals as persons.