Unpaid internships are legal when they are closely tied to interns' educations, a U.S. appeals court in Manhattan said on Thursday in reversing a decision that Fox Searchlight Pictures Inc. broke the law by not paying interns.

The lower courts erred in finding the interns should have been treated as employees because Fox derived some benefit from their work, the 2nd U.S. Circuit Court of Appeals said.

As long as internships are designed chiefly to further young people's knowledge in a particular field, the court said, interns do not have to be paid.

"The purpose of a bona fide internship is to integrate classroom learning with practical skill development in a real-world setting," Circuit Judge John Walker wrote.

In a separate decision, the court upheld a judge's ruling that the Hearst Corp. did not have to pay interns who worked on its popular magazines.

The court sent the cases back to U.S. judges in Manhattan to decide whether the Fox and Hearst internships were primarily educational.

A Hearst spokesperson said the decision "preserves opportunities for a broad range of students to be educated in work environments to which they might not otherwise have access."

Fox Searchlight, a unit of 21st Century Fox Inc., did not return a request for comment.

Rachel Bien, the lawyer who represents the former interns in both cases, said she was pleased the court created a clear rule.

"Many of the most abusive internships involving low-level tasks and grunt-type work are plainly illegal under this standard," she said.

The Fox interns worked at the company's corporate offices in New York and on the 2010 film "Black Swan." The interns who filed the suit say they worked up to 50 hours a week performing various job duties.

The lower court's 2013 decision in that case spurred many similar lawsuits. Warner Music Group Corp last month agreed to pay more than $4.2 million to hundreds of interns, following even larger settlements by Comcast Corp.'s NBCUniversal, Condé Nast and Viacom Inc.