The Supreme Court ruled Thursday that unions must give nonmembers an immediate chance to object to unexpected fee increases or special assessments that all workers are required to pay in closed-shop situations.

The court ruled for Dianne Knox and other nonmembers of the Service Employees International Union's Local 1000, who wanted to object and opt out of a $12 million special assessment the union required from its California public sector members for political campaigning. Knox and others said the union did not give them a legally required notice that the increase was coming.

The union, and the 9th U.S. Circuit Court of Appeals, said the annual notice that the union gives was sufficient. The high court disagreed in a 7-2 judgment written by Justice Samuel Alito.

"When a public-sector union imposes a special assessment or dues increase, the union must provide a fresh ... notice and may not exact any funds from nonmembers without their affirmative consent," Alito said.

Justices Sonia Sotomayor and Ruth Bader Ginsburg agreed with the judgment but wrote their own opinion. "When a public-sector union imposes a special assessment intended to fund solely political lobbying efforts, the First Amendment requires that the union provide non-members an opportunity to opt out of the contribution of funds," Sotomayor wrote.

But Sotomayor and Ginsburg said they did not join in the majority opinion that the First Amendment requires an opt-in system for other circumstances like "the levying of a special assessment or dues increase."

Justices Stephen Breyer and Elena Kagan dissented from the opinion. "If the union's basic administrative system does not violate the Constitution, then how could its special assessment have done so?" Breyer said. But Breyer said he agreed with Sotomayor on the court's decision to expand the decision beyond special political assessments. "No party has asked that we do so," he said. "The matter has not been fully argued in this court or in the courts below," said Breyer, who read his dissent aloud.

Alito said there is "no merit" to Breyer's and Sotomayor's complaints.