Washington (CNN) The Supreme Court dealt a major blow to public sector unions on Wednesday in a case that could shake their financial structure and undermine their future stability.
The justices struck down an Illinois law that required non-union workers to pay fees that go to collective bargaining and overturned a 1977 law that required employees to pay so-called "fair share" fees.
The ruling was 5-4 along familiar ideological lines, with conservative Justice Samuel Alito writing for the majority in a case that highlights how the blocking of President Barack Obama's Supreme Court nominee has dramatically changed the legal and political landscape.
"It is hard to estimate how many billions of dollars have been taken from nonmembers and transferred to public-sector unions in violation of the First Amendment. Those unconstitutional exactions cannot be allowed to continue indefinitely," Alito wrote.
In a blistering dissent, Justice Elena Kagan wrote, "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."
Reading from the bench, a move justice only does when he or she thinks a ruling is egregiously wrong, Kagan added: "There's no sugarcoating today's opinion."
The ruling is another key example where the Senate GOP leader Mitch McConnell's move to block Judge Merrick Garland in 2016 after the death of Justice Antonin Scalia has paid dividends for conservatives. President Donald Trump nominated Justice Neil Gorsuch, who has helped cement the conservative bloc on the court.
"It's the 14th different decision this term in which the conservatives banded together to produce a 5-4 majority, in all of which there's good reason to doubt whether a Justice appointed by a Democratic President would have voted the same way," said Steve Vladeck, a CNN Supreme Court analyst and professor at the University of Texas School of Law.
This case could also significantly hurt Democrats, Vladeck said.
"This decision in particular will likely have ramifications at the ballot box," Vladeck said, "since it will weaken the economic health -- and political power -- of public-sector unions, which tend to support Democratic candidates more often than Republicans."
Wednesday is the second time in recent weeks where a 5-4 court has infuriated advocates for workers' rights. The court ruled in May that employers could require employees to sign class action waivers in employment arbitration agreements that bar them from banding together to fight legal disputes.
At the center of the debate is a 1977 Supreme Court opinion known as Abood v. Detroit Board of Education that says while non-members of public sector unions cannot be required to pay fees for a union's political activities, they can be required to pay so-called "fair share" fees pertaining to issues such as employee grievances, physical safety and training.
In recent years, so-called Right to Work groups as well as some conservatives on the court have pushed for it to be overturned. Wednesday, nearly half of all states have laws on the books that allow broad fair share fees for public employees.
The case was brought by Mark Janus, an Illinois public sector employee, who challenged the fees. He said that because he is a government employee, issues germane to collective bargaining are inherently political. He argued that the First Amendment protected him from having to support such political expression.
Janus has been represented in the challenge by groups such as the National Right to Work Legal Defense Foundation and the Liberty Justice Center.
The Trump administration sided with Janus in the case, reversing course from the Obama administration in a 2016 case when the court heard arguments in a similar challenge, but deadlocked in a 4-4 split following Scalia's death.
The American Federation of State, County and Municipal Employees, which represents public sector employees, described the challenge as a threat to American workers.
The public sector unions argue that they are required by law to represent all employees regardless of if they are members and that no one is required to join the union.
If non-members don't have any obligation to pay fair share fees for the collective bargaining obligations, they would become free riders, benefiting from the representation without sharing the costs, the unions say. The coffers of public sector unions would also suffer if non-members were able to get services for free.
Alito noted, and dismissed, the impact to union funds.
"We recognize that the loss of payments from non-members may cause unions to experience unpleasant transition costs in the short term, and may require unions to make adjustments in order to attract and retain members," Alito wrote.
"But we must weigh these disadvantages against the considerable windfall that unions have received under Abood for the past 41 years," he added.
Kagan argued that the majority's decision was poorly reasoned.
"The majority has overruled Abood for no exceptional or special reason, but because it never liked the decision," she said. "It has overruled Abood because it wanted to."
The comment seemed to be directed particularly at Chief Justice John Roberts, who often says he does not like to overturn precedent.
"Rarely if ever has the Court overruled a decision -- let alone of this import -- with so little regard for the usual principles of stare decisis," she wrote.
She also highlighted the practical impact of Wednesday's decision.
"State and local governments that thought agency fees furthered their interests will need to find new ways of managing their workforces," Kagan wrote. "Across the country, the relationships of public employees and employers will alter in both predictable and whole unexpected ways."
Janus reacted to the ruling by calling it a "historic day."
"We now have 5 million public sector union members or non-union members that can make their own choices as to whether they want to be a part of that union," he said.
The Justice Department said on Wednesday it was "pleased" with the court's decision.
"We are pleased with today's decision. Public employees should not be forced to pay into a union against their will and support a political message with which they may disagree," department spokesperson Kerri Kupec said in a statement.
In a statement reacting to the ruling, Paul Shearon of the International Federation of Professional and Technical Engineers said that the case "was based on a bogus free speech argument" and that in the short run, the decision "may hurt some unions financially."
But, he said, "in the long run it will serve to make unions and their members more militant and force a stronger culture of internal organizing."