(Reuters) - The U.S. Supreme Court on Tuesday tightened rules on where injury lawsuits may be filed, handing a victory to corporations by undercutting the ability of plaintiffs to bring claims in friendly courts in a case involving Texas-based BNSF Railway Co.

A general view of the U.S. Supreme Court building in Washington, U.S., November 15, 2016. REUTERS/Carlos Barria

The justices, in a 8-1 ruling, threw out a lower court decision in Montana allowing out-of-state residents to sue there over injuries that occurred anywhere in BNSF’s nationwide network. State courts cannot hear claims against companies when they are not based in the state or the alleged injuries did not occur there, the justices ruled.

BNSF [BNISF.UL] is a subsidiary of Berkshire Hathaway Inc.

“BNSF is grateful to the Supreme Court for the clarification they provided in deciding this case,” the company said in a statement.

Businesses and plaintiffs have been engaged in a fight over where lawsuits seeking financial compensation for injuries should be filed.

Companies typically can be sued in a state where they are headquartered or incorporated, as well as where they have significant ties. They want to curb plaintiffs’ ability to “shop” for courts in states with laws conducive to such injury lawsuits.

Plaintiffs contend that corporations are trying to limit their access to compensation for injuries by denying them their day in state courts.

“Going forward, some injured rail workers may have to travel far from home just to reach a courthouse that can hear their claims. Workers already suffering from disabling injuries caused by their employers shouldn’t have to bear that burden,” said Julie Murray, a lawyer for the plaintiffs.

Her clients will still be able to press their claims in Montana state court, Murray added.

The case involves two lawsuits against BNSF brought under the Federal Employers’ Liability Act, a U.S. law that allows injured railroad employees to sue for compensation from their companies.

BNSF fuel truck driver Robert Nelson sued in 2011 over a slip-and-fall accident in which he injured his knee. Kelli Tyrrell, the widow of railroad employee Brent Tyrrell, sued in 2014 alleging her husband was exposed to chemicals that caused him to die of kidney cancer.

Neither BNSF employee lived in Montana and their allegations did not occur in the state, according to court filings.

BNSF argued that the Montana courts did not have jurisdiction over the cases. The Montana Supreme Court in May, however, ruled that state courts there can hear cases against BNSF without violating due process rights guaranteed in the U.S. Constitution because the company does business in the state.

Writing for the majority on Tuesday, liberal Justice Ruth Bader Ginsburg said that even though BNSF has more than 2,000 miles (3,200 km) of track and 2,000 employees in Montana, it cannot be held liable for “claims like Nelson’s and Tyrrell’s that are unrelated to any activity occurring in Montana.”

Liberal Justice Sonia Sotomayor dissented, calling the ruling a “jurisdictional windfall” for large multistate or multinational corporations.

“It is individual plaintiffs, harmed by the actions of a far-flung foreign corporation, who will bear the brunt of the majority’s approach and be forced to sue in distant jurisdictions with which they have no contacts or connection,” Sotomayor wrote.

The Supreme Court is also expected to rule before the end of June in a similar challenge brought by drug maker Bristol-Myers Squibb, which says it should not have to face injury suits filed by hundreds of out-of-state residents in California over its blood-thinning medication Plavix. The company is incorporated in Delaware and headquartered in New York.

Conservative Justice Neil Gorsuch joined the majority on Tuesday, the first ruling he has participated in since joining the court in April.