The Supreme Court reversed a lower court ruling that found in favor of warehouse workers, who alleged they spent up to 25 minutes waiting through security checks at the end of their shifts. (Karen Bleier/AFP/Getty Images)

The Supreme Court ruled unanimously Tuesday that workers who fill orders in warehouses need not be paid for the time they spend going through security checks to ensure they have not stolen any products.

The court reversed a lower-court ruling for the workers, who alleged they spent up to 25 minutes waiting to go through security clearance at warehouses in Nevada.

But Justice Clarence Thomas said federal law requires that workers be paid for activities before and after their shifts only when the activities are “integral and indispensable” to the job they are hired to perform.

“The court of appeals erred by focusing on whether an ­employer required a particular activity,” Thomas wrote. “The integral and indispensable test is tied to the productive work that the employee is employed to perform.”

The U.S. Court of Appeals for the 9th Circuit had ruled for the workers, but other appeals courts had interpreted the law the way the Supreme Court did.

The class-action lawsuit was filed against Integrity Staffing Solutions, a company that provides workers for Amazon warehouses across the nation. ( chief executive Jeffrey P. Bezos also owns The Washington Post.)

The implications of the decision would have been great had it gone the other way. There are more than a dozen class-action lawsuits filed against Amazon and other companies that use security checks at the end of shifts to make sure none of their inventory walks out with the workers. A win would have opened the way for hundreds of millions of dollars in compensation.

The court was examining the Portal-to-Portal Act, which Congress passed in 1947 to exempt companies from having to pay overtime for certain activities that take place before and after a worker’s shift.

In previous cases, the court has identified activities that qualify as integral and indispensable to a worker’s duties. For instance, it said the time battery-plant employees spend showering and changing was compensable because of the toxic chemicals in the plant.

The court also held that meatpacking workers should be paid for sharpening knives because dull knives would make them less effective and affect the appearance of the product.

But the court noted Labor Department regulations that said employees need not be paid for “checking in and out and waiting in line to do so,” among other activities. The Obama administration sided with the company.

Jesse Busk, who worked in the Amazon warehouse in Las Vegas, and Laurie Castro, an hourly employee in Fenley, Nev., claimed that because the security checks were required for workers to keep their jobs, employees should be compensated for the time they spend waiting for security checks. And they said that the company could cut the wait time by employing more security screeners or staggering shifts so that not all the workers were released at once.

The court rejected both arguments. The company “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 wrote.

And he said it was irrelevant whether the company had ways to reduce the wait time. “These arguments are properly presented to the employer at the bargaining table, not to a court,” he wrote.

Amazon said the allegations from Busk and Castro “were simply not true.”

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

Joshua D. Buck, a lawyer for the class of workers represented by Busk and Castro, called the decision “very disappointing.”

“An employer is now free to waste as much of workers’ time as it so desires by forcing them to undergo time-consuming anti-theft screenings without compensation,” Buck said in a statement.

Justices Sonia Sotomayor and Elena Kagan concurred in the decision but also wrote to say they understood the Portal-to-Portal Act to distinguish between the ingress and egress process, on one hand, and activities that constitute actual work of consequence, on the other.

The security checks at issue fall on the side of leaving the workplace, Sotomayor wrote.

The case, Integrity Staffing Solutions v. Busk, was one of the court’s first two signed opinions of the term.