The court ruled that forcing government employees to pay union dues violates the First Amendment.

The Supreme Court ruled Wednesday public-sector unions cannot force nonmembers to pay dues, dealing a blow to organized labor.

The five conservatives in the majority ruled that forcing government employees to pay union dues violates the First Amendment, because it requires them to endorse political views they may disagree with. Public sector unions could lose millions of dollars and see their influence diminish as a result of the ruling.

The court overturned a 1977 ruling in Abood v. Detroit Board of Education, which found unions can compel dues for negotiating purposes, but not for political spending. Nonmembers had been entitled to refunds for political spending. In overturning that precedent, the court ruled that distinction is untenable and the ruling was “poorly reasoned.”

The unions argued it’s important to force dues in part to avoid free riders — those who benefit from collective bargaining but opt out from membership to avoid paying the fees — and that Abood ensured they would not be compelled to fund political efforts. The court found the issue of avoiding free riders to be outside the government’s interest and domain, and certainly second to free speech claims, and further found no sharp distinction between political and nonpolitical activities with the collected dues.

Collective bargaining is “inherently political,” Justice Samuel Alito wrote in the opinion, and the Abood decision did not take into account the administrative problems that would arise in trying to distinguish between political and nonpolitical expenditures.

“The First Amendment is violated when money is taken from nonconsenting employees for a public-sector union; employees must choose to support the union before anything is taken from them,” the opinion states. “Accordingly, neither an agency fee nor any other form of payment to a public-sector union may be deducted from an employee, nor may any other attempt be made to collect such a payment, unless the employee affirmatively consents to pay.”

The four liberal justices on the court cast the dissenting votes.

The case was brought by Mark Janus, a government employee in Illinois who sued his union because he does not agree with its political positions and should not be forced to pay dues. The ruling does not apply to private sector unions, but is nevertheless a blow to organized labor, because it primarily represents public sector employees.