NEW YORK (AP) — Painter and photographer Richard Prince, whose works have sold for millions of dollars, did not violate copyrights with most of the paintings and collages he based on a photographer’s published works, a federal appeals court ruled Thursday in a case closely watched within the art community.

The 2nd U.S. Circuit Court of Appeals in Manhattan ruled that Prince had sufficiently transformed 25 of 30 pictures taken by photographer Patrick Cariou and published in a 2000 book that Prince’s art could be considered a “fair use” of Cariou’s work. The appeals court sent five pictures back to a lower court judge to decide whether they violated copyrights.

Central to the case were pictures Cariou took during six years he lived with Rastafarians in Jamaica. Prince altered and incorporated several of the photographs in a series of paintings and collages titled “Canal Zone,” exhibited in 2007 and 2008.

The 2nd Circuit ruling largely overturned a decision by U.S. District Judge Deborah A. Batts that had found in Cariou’s favor. Batts had ordered all infringing copies of the photographs, including the paintings and unsold copies of “Canal Zone,” turned over to Cariou, who could decide to destroy them if he wished. The appeals court noted that Cariou had said he would not destroy them.

The appeals court, in a majority decision written by Judge Barrington Parker, said Batts was incorrect to conclude that Prince’s art needed to comment on Cariou’s work to be considered different enough and “fair use,” a legal term that describes the point at which art based on a copyrighted work is transformed enough that copyrights are not violated.

The decision said 25 of Prince’s artworks “manifest an entirely different aesthetic” from Cariou’s photographs.

“Where Cariou’s serene and deliberately composed portraits and landscape photographs depict the natural beauty of Rastafarians and their surrounding environs,” the decision said, “Prince’s crude and jarring works, on the other hand, are hectic and provocative.”

The 2nd Circuit noted that Cariou, who lives in Paris, has not aggressively marketed his photographs and had earned just over $8,000 in royalties from a book of the pictures, while some of Prince’s “Canal Zone” artworks have sold for $2 million or more.

The court also noted that the invitation list for a dinner that was hosted in conjunction with the opening of the “Canal Zone” show included wealthy and famous people, such as Robert De Niro, Angelina Jolie and Brad Pitt, Jay-Z and Beyonce, artists Damien Hirst and Jeff Koons, New England Patriots quarterback Tom Brady and supermodel wife Gisele Bundchen, Vogue editor Anna Wintour and authors Jonathan Franzen and Candace Bushnell.

Prince sold eight artworks for $10.4 million at the gathering, the court said as it explained why his art would not damage the potential market for Cariou’s photographs.

“Prince’s audience is very different from Cariou’s,” the court said.

Attorney Dan Brooks, representing Cariou, said the ruling isn’t the end but is “just one step in a long process.”

He said the 2nd Circuit seemed to be saying “because one artist is not well known and hasn’t been commercially successful, it’s OK for another artist with impunity to just steal his stuff as long as he’s famous and selling his art to rich people.”

Brooks said the decision was at odds with “fair use” rulings by other federal appeals courts.

Attorney Josh Schiller, representing Prince, called the decision “great news” that was “important not just for Richard Prince but for all artists.”

“It was not about money and wealth,” Schiller said, adding that it protects the rights of those artists who specialize in transforming images into new works of art.

Judge J. Clifford Wallace wrote a separate decision that agreed in part and dissented in part with the majority opinion. In it, he said he believed all the paintings should have been returned to the lower court to decide if they infringed copyrights.