The Supreme Court on Wednesday pondered when the working day ends for hourly employees at an warehouse: when the worker punches the time clock, or later, when he clears a security check to make sure he hasn’t stolen anything.

Several justices seemed to think it was the former. But others seemed sympathetic to a lawsuit filed by workers at a Nevada facility arguing that enduring the wait to go through security — up to 25 minutes, according to those who filed the suit — was part of the job, and they should be paid for it.

The implications are great: there are more than a dozen class-action suits filed against Amazon and others who believe security checks are necessary to make sure none of their inventory walks out with the workers. A win could open the way for hundreds of millions of dollars in pay.

Paul D. Clement, representing Integrity Staffing Solutions, a company that supplies workers for, said waiting to go through a security check is a “classic” example of the kind of activity, like commuting, for which courts have said employers do not have to pay.

Going through security is not “integral and indispensable” to the job for which a worker is hired.

Justice Elena Kagan was not convinced, especially at companies where a tight control over their warehouses is essential.

“I mean, what makes it Amazon?” Kagan asked Clement. “It’s a system of inventory control that betters everybody else in the business. And what’s really important to Amazon is that it knows where every toothbrush in the warehouse is.”

But Assistant Solicitor General Curtis E. Gannon — the Obama administration is siding with employers in the case — said that was not enough. “The idea that this benefits the employer or is required by the employer isn’t enough to make it compensable,” Gannon said.

Well, how about this, Kagan asked: There was a federal judge in New York “ages ago . . . who had his clerks — all that they did was help him with his opinions and his cases and that was their principal activity — but had his clerks come early in order to cut his grapefruit and otherwise make breakfast for him.” Compensation for that?

Gannon said he thought that might be, because it seemed like part of what the judge required of them, and not about whether they were coming to work or leaving.

The key to the case would appear to be the court’s reading of the long-debated Portal-to-Portal Act, which says that employers do not have to pay for things that take place before or after the workday. The court has said companies must pay for activities that are an “integral and indispensable part of the principal activities” of the job.

The lawsuit was filed in 2010 by two employees who worked at a sprawling Amazon warehouse in Nevada. ( chief executive Jeffrey P. Bezos owns The Washington Post.) After clocking out at the end of the day, they and other employees had to empty their pockets and pass through screening.

They allege that the security checks were understaffed and that since many employees left at the same time, the wait to pass through screening could be as long as 25 minutes. (Clement noted that was only an allegation and that the wait is usually much shorter.)

A district judge dismissed their suit, but the U.S. Court of Appeals for the 9th Circuit reversed and said the suit could go forward. The court found that the security checks were necessary to the employee’s primary work and that it was for the benefit of the company.

Mark R. Thierman of Reno, representing the workers, said employers are free to require employees to do all manner of things, but they must be paid for it.

“A person is hired to do what they are told to do,” he said. “That’s your job. It’s not whether it exists in some kind of abstract job function or abstract flow chart.”

But several justices were skeptical that going through a security check was an essential part of someone’s work.

“No one’s principal activity is going through security screening,” said Chief Justice John G. Roberts Jr. “He hires them to do something else and then the employee screening is certainly not the principal” responsibility.

Added Justice Antonin Scalia: Being inspected “as you leave the place of business is not part of the job.”

Clement said paying employees to stand in line to pass through security would also be unmanageable, and create a strange situation.

“One of the many reasons not to adopt their rule is you don’t want to create an incentive for every employee to try to get to the back of the line, which is hardly going to speed things up,” he said.

The case is Integrity Staffing Solutions v. Busk.