WASHINGTON — The Supreme Court ruled on Wednesday that Nigerian plaintiffs who said foreign oil companies had been complicit in violating their human rights may not sue in American courts. The decision limited the sweep of a 1789 law that had been used to address human rights abuses abroad.

The decision was unanimous, but the justices divided along ideological lines in their reasoning.

Human rights groups said the decision was a sharp blow.

“This decision so severely limited a law that has for decades been a beacon of hope for victims of gross human rights violations,” said Elisa Massimino, president of Human Rights First. “This decision cuts a hole into the web of accountability. Human rights abusers may be rejoicing today, but this is a major setback for their victims.”

Business groups said the ruling would help put an end to baseless lawsuits.

“The U.S. Supreme Court’s decision today ensures that trial lawyers cannot continue to use the American judicial system to expose global businesses to frivolous and costly lawsuits,” said Thomas J. Donohue, president of the U.S. Chamber of Commerce.