An ideologically divided Supreme Court ruled Monday that companies may require workers to settle employment disputes through individual arbitration rather than joining to press their complaints, a decision affecting as many as 25 million workers.

The court’s conservative majority said that the 5-to-4 ruling was a logical reading of federal law, and Congress’s preference for using arbitration to avoid costly and time-consuming litigation.

But the decision, involving a wage dispute, was roundly criticized on the left, and advocates said it could make it harder to press other workplace complaints such as discrimination and sexual harassment.

“Employees may now be forced behind closed doors into an individual, costly — and often secret — arbitration process,” said Fatima Goss Graves, president and chief executive of the National Women’s Law Center. “This will stack the deck in favor of the employer.”

The decision also underscored the importance of the 2016 presidential election’s impact on the judiciary. The Obama administration and the National Labor Relations Board had backed workers in the cases, but after President Trump was elected, the Justice Department threw its support to the employers.

And the ruling was written by Trump’s nominee to the court, Justice Neil M. Gorsuch. It is far more likely that the 5-to-4 decision would have gone the other way if President Barack Obama’s nominee to the court, Judge Merrick Garland, had been confirmed.

The decision came in what is considered the most important business case of the term. It expands upon recent Supreme Court decisions that permit corporations to avoid class-action lawsuits from consumers by enforcing contracts that call for individual arbitration.

Gorsuch, writing for the conservative majority, outlined the question presented by this case: Should employers be allowed to insist that workplace disputes be handled in one-on-one arbitration, or should employees always have an option of bringing claims in collective actions?

“As a matter of policy these questions are surely debatable,” Gorsuch wrote. “But as a matter of law the answer is clear. In the Federal Arbitration Act, Congress has instructed federal courts to enforce arbitration agreements according to their terms — including terms providing for individualized proceedings.”

Gorsuch was joined by Chief Justice John G. Roberts Jr. and Justices Anthony M. Kennedy, Clarence Thomas and Samuel A. Alito Jr.

Workers had contended that another federal law, the National Labor Relations Act, makes illegal any contract that denies employees the right to engage in “concerted activities” for the purpose of “mutual aid and protection.” That means that some sort of collective action cannot be prohibited, the workers say.

That was the thrust of a forceful dissent…