Apple Inc. persuaded a judge to throw out a lawsuit by employees of the company’s retail stores in California seeking back pay for time spent in “demoralizing” security searches when they left work for the day.

The ruling by a San Francisco federal judge Saturday releases the company from having to compensate as many 12,400 former and current employees from 52 stores throughout the state a few dollars a day for time spent over a six-year period having their bags and Apple devices searched at meal breaks and after their shifts. A law professor who reviewed filings in the case estimated Apple could have been be on the hook for as much as $60 million, plus penalties.

Workers were free to choose to avoid searches by not bringing bags with them, U.S. District Judge William Alsup said in the ruling. “It is undisputed that some employees did not bring bags to work and thereby did not have to be searched when they left the store,” he said.

The U.S. Supreme Court ruled last year that workers don’t have a federal right to be paid for time spent in post-shift security searches, unanimously rejecting claims by former Inc. warehouse workers. That decision left an opening for the Apple workers to pursue their case under California law.

Alsup ruled in July that the handful of ex-employees who filed the suit in 2013 could proceed on behalf of all the other current and former Apple Store workers who were subject to the searches since 2009.

“Plaintiffs are disappointed in the court’s ruling and are exploring their options, including an appeal,” Lee Shalov, a lawyer for the workers, said in an e-mail.

An Apple representative didn’t immediately return a phone message seeking comment on the ruling.

The last big employment lawsuit Apple faced was resolved ahead of trial after a judge granted group status to thousands of former employees to pursue claims that the iPhone maker, Google Inc. and other Silicon Valley technology giants conspired to drive down wages by not hiring each other’s employees. That case settled for $415 million.

The case is Frlekin v. Apple, 13-cv-03451, U.S. District Court, Northern District of California (San Francisco).