The Supreme Court ruled Thursday for an Arizona church in a dispute over a town's sign law in a decision that three justices said could threaten municipal sign regulations across the country.

The court unanimously agreed to strike down a law in Gilbert, Arizona, that set tougher rules for signs that direct people to Sunday church services than for signs for political candidates and real estate agents.

But the justices divided over why the law violated the rights of the Good News Community Church.

The church complained that the law forced the church to put up smaller signs than those for political candidates, real estate agents and others. The church's signs also could be in place for short periods of time.

Lower federal courts upheld the town's sign ordinance, saying the distinction it drew between different kinds of temporary signs was not based on what a sign said.

But Justice Clarence Thomas rejected that argument in his majority opinion for six of the nine justices. Thomas said political signs are "given more favorable treatment than messages announcing an assembly of like-minded individuals. That is a paradigmatic example of content-based discrimination." Under the rigorous review the court gives to laws that treat speakers differently because of content, the law must fall, he said.

Justice Elena Kagan said she fears that all sign ordinances now will have to face the same strict review and many "are now in jeopardy" because of Thursday's decision.

There was a narrower way to decide the case in the church's favor, Kagan said. The town's defense of its sign ordinance was marked by the "absence of any sensible basis" for distinguishing between signs and did not pass "even the laugh test," she said.

Justices Stephen Breyer and Ruth Bader Ginsburg joined Kagan's opinion.