In a 5-4 vote, a divided U.S. Supreme Court handed a setback to organized labor by placing new limits on the ability of unions to demand fees from some public-sector workers. The high court invalidated Illinois rules requiring union payments from people who provide in-home care for disabled Medicaid recipients. The majority said those rules violated the workers’ constitutional right to freedom of speech and association because the home health-care workers weren’t true public employees. Left standing by the majority was a 1977 high court ruling that public-sector employees could be compelled to pay for union representation as long as they don’t have to cover the cost of political or ideological activities.

Alito called that 37-year-old decision “questionable,” while stopping short of overturning it. He said the Service Employees International Union was asking the court to expand the precedent so it applied not just to “full-fledged public workers” but also to others deemed government employees for the sole purpose of unionization and the payment of dues.

The high court’s ruling will directly affect about 12 states with similar rules and could have ramifications in the 26 states without “right to work” laws that let workers opt out of union dues. The dispute pitted labor unions and President Barack Obama’s administration against right-to-work advocates. The administration said in a statement that while the White House was disappointed by today’s decision, it remained committed to defending collective-bargaining rights.

Public worker union rights have been a hot political and legal topic in recent years, highlighted by Wisconsin Governor Scott Walker’s successful 2011 effort to curb collective-bargaining rights there. More than 7 million government workers were union members last year, according to the National Right to Work Foundation, whose legal arm represented the Illinois challengers before the Supreme Court. About as many people now belong to unions in the public sector as in the private sector.