In a major legal and political defeat for big labor, the Supreme Court ruled 5-4 Wednesday that state government workers cannot be forced to pay so-called "fair share" fees to support collective bargaining and other union activities.

The conservative majority said a union's contract negotiations over pay and benefits were inextricably linked with its broader political activities, and concluded workers had a limited constitutional right not to underwrite such "speech." The case specifically examined union fees paid by non-members.

“This procedure violates the First Amendment and cannot continue,” Associate Justice Samuel Alito wrote in the majority opinion. “Neither an agency fee nor any other payment to the union may be deducted from a non-member’s wages, nor may any other attempt be made to collect such a payment, unless the employee affirmatively consents to pay.”

While the current case applies only to public-sector employees, the political and financial stakes are potentially huge for the broader American labor union movement, which had been sounding the alarm about the legal fight.

CLICK TO READ THE OPINION

The unions say 5 million government employees in 24 states and the District of Columbia would be affected by this ruling.

The majority overturned the high court's four-decade-old precedent -- known as the "Abood" decision -- dealing with so-called "agency" fees, allowing states to require public employees to pay money supporting collective bargaining and other union activities.

Alito said while overturning past decisions should be rare, this issue justified it.

"There are very strong reasons in this case. Fundamental free speech rights are at stake," he said.

The key plaintiff was Mark Janus, an Illinois state employee, who pays about $550 annually to the powerful public-sector union known as AFSCME. While not a member of the union, he is required under state law to hand over a weekly portion of his paycheck -- which he says is a violation of his constitutional rights.

"I work for Health and Family Services, and I'm forced to pay money to a union that then supports political causes that I don't agree with," Janus told Fox News.

President Trump cheered the court decision on Twitter, writing: “Supreme Court rules in favor of non-union workers who are now, as an example, able to support a candidate of his or her choice without having those who control the Union deciding for them. Big loss for the coffers of the Democrats!”

Trump's Justice Department has been clear on its position -- announcing in December it was reversing course from the previous administration and supporting Janus.

Writing the dissent for the court's four liberal members, Associate Justice Elena Kagan said the majority succeeded in its "crusade" by "turning the First Amendment into a sword."

"Judicial disruption does not get any greater than what the Court does today," she said in a rare oral dissent read from the bench. "The majority has overruled Abood for no exceptional or special reason, but because it never liked the decision. It has overruled Abood because it wanted to. Because, that is, it wanted to pick the winning side in what should be -- and until now, has been -- an energetic policy debate."

Associate Justices Ruth Bader Ginsburg, Stephen Breyer and Sonia Sotomayor joined her.

"Almost all economic and regulatory policy affects or touches speech,” Kagan added. “So the [court] majority’s road runs long. And at every stop are black-robed rulers overriding citizens’ choices. The First Amendment was meant for better things. It was meant not to undermine but to protect democratic governance-including over the role of public-sector unions."

Justices split 4-4 on the issue in a similar case two years ago, just after Antonin Scalia died. But with Neil Gorsuch now filling the vacancy left by Scalia, he was seen as the deciding vote this time. During arguments back in February, Gorsuch played it close to the vest and left court watchers guessing -- he had no comments or questions from the bench during nearly 70 minutes of oral arguments.

On Wednesday, he sided with the conservative majority.

Labor leaders oppose so-called "free riding" by workers like Janus, however, and say they have a legal duty to advocate for all employees.

Nearly 30 states have so-called "right-to-work laws" that restrict forced fees. But many public-employee union members are in other states.

States that do allow "fair share" fees say they go to a variety of activities that benefit all workers, whether in the union or not. That includes collective bargaining for wage and benefit increases, grievance procedures, and workplace safety.

AFSCME President Lee Saunders had argued that strong labor unions are needed because they give “the strength in numbers [workers] need to fight for the freedoms they deserve,” including retirement plans and health care.

The repercussions could affect unions nationwide. Union membership nationwide is less than 11 percent of the American workforce, but about a third of government employees are members.