A US judge has ruled that a macaque monkey who snapped grinning selfies that went viral last year online does not own the copyright to the photographs.

Activist group People for the Ethical Treatment of Animals brought the case in San Francisco on behalf of Indonesian simian Naruto, who shot to fame last year after a photographer published pictures taken by the monkey with his camera.

PETA petitioned the court to have the macaque “declared the author and owner of his photograph.”

But in a preliminary ruling Wednesday, Judge William Orrick said that “while Congress and the President can extend the protection of law to animals as well as humans, there is no indication that they did so in the Copyright Act.”

The photos were taken in 2011 on the Indonesian island of Sulawesi by British nature photographer David Slater. He later published a book of his photographs, which included two selfies taken by six-year-old Naruto.

The San Francisco-based company that published the book — Blurb — was named as a co-defendant in the case.

In filing the lawsuit, PETA had argued that “US copyright law doesn’t prohibit an animal from owning a copyright, and since Naruto took the photo, he owns the copyright, as any human would.”

Slater insists he owns the rights since he set up the tripod and walked away for a few minutes only to find out that the monkey had grabbed his camera and snapped away.

When the copyright controversy erupted, he said that the widespread distribution of the photos on the Internet had cost him a lot of money by robbing his book of potential sales.