WASHINGTON — The Supreme Court ruled Tuesday that warehouse workers who fill orders for retail giant Amazon don’t have to be paid for time spent waiting to pass through security checks at the end of their shifts.

The unanimous decision is a victory for the growing number of retailers and other companies that routinely screen workers to prevent employee theft. The justices said federal law does not require companies to pay employees for the extra time because it is unrelated to their primary job duties.

Some workers at Amazon contractor Integrity Staffing Solutions Inc. claim they wait up to 25 minutes to clear security before they can go home. Amazon has disputed those claims.

The Supreme Court reversed a ruling from the Ninth U.S. Circuit Court of Appeals, which said the screenings should be compensated because they were performed for the employer’s benefit and were integral to the workers’ jobs.

The case was being watched closely by business groups worried that employers could be on the hook for billions of dollars in retroactive pay for workers seeking pay for time spent in security checks.

Writing for the court, Justice Clarence Thomas said the screenings are not the “principal activity” which the workers are employed to perform.

“Integrity Staffing did not employ its workers to undergo security screenings, but to retrieve products from warehouse shelves and package those products for shipment to Amazon customers,” Thomas said.

Thomas also said the security checks were not “integral and indispensable” to the employees’ duties as warehouse workers. He based his decision on a federal law called the Portal-to-Portal Act, which specifically exempts employers from paying for pre- and post-work activities such as waiting to pick up protective gear or waiting in line to punch the clock.

The case was brought by Jesse Busk and Laurie Castro, two former workers at a Nevada Amazon warehouse who were employed by Integrity. Their lawyer argued that waiting in long security lines to go through metal detectors and empty their pockets each day was work because their employer required them to do it to keep merchandise from being stolen.

Amazon was not a party to the Supreme Court case. The company declined to comment on the decision, but it disputed claims of long wait times for security checks.

“Data shows that employees typically walk through security with little or no wait, and Amazon has a global process that ensures the time employees spend waiting in security is less than 90 seconds,” said company spokeswoman Kelly Cheeseman.

Josh Buck, an attorney representing Busk and Castro, called the court’s ruling disappointing.

“The well-known idiom 'time is money’ obviously does not apply to working people,” Buck said.

Since the Ninth Circuit’s ruling last year, at least four class-action lawsuits have been filed against Amazon.com seeking compensation for time that nearly 100,000 workers have spent in post-shift security screenings. Similar suits are pending against CVS Pharmacy and Apple Inc.