PARIS — France’s top administrative court overturned a ban on burkinis in a Mediterranean town, in a decision Friday that should set legal precedent regarding a swimsuit crackdown that has divided the country and provoked shock around the world.

The ruling by the Council of State Friday specifically concerns a ban on the Muslim garment in the Riviera town of Villeneuve-Loubet, but the binding decision is expected to impact all the 30 or so French resort municipalities that have issued similar decrees.

The bans grew increasingly controversial as images circulated online of some Muslim women being ordered to remove body-concealing garments on French Riviera beaches.

Lawyers for a human rights group and a Muslim collective challenged the legality of the ban to the top court, saying the orders infringe basic freedoms and that mayors have overstepped their powers by telling women what to wear on beaches.

Mayors had cited multiple reasons for the bans, including security after a string of Islamic extremist attacks, risk to public order, and France’s strict rules on secularism in public life.

The Council of State ruled that, “The emotion and concerns arising from the terrorist attacks, notably the one perpetrated in Nice on July 14, cannot suffice to justify in law the contested prohibition measure.”

It ruled that the mayor of Villeuneuve-Loubet overstepped his powers by enacting measures that are not justified by “proven risks of disruptions to public order nor, moreover, on reasons of hygiene or decency.”

“The contested decree has thus brought a serious and manifestly illegal infringement on basic freedoms such as freedom to come and go, freedom of conscience and personal freedom,” the ruling reads.

Lawyer Patrice Spinosi, representing the Human Rights League, told reporters in Paris that women who have already received fines can protest them based on Friday’s decision.

“It is a decision that is meant to set legal precedent,” he said. “Today all the ordinances taken should conform to the decision of the Council of State. Logically the mayors should withdraw these ordinances. If not legal actions could be taken” against those towns.

But the mayor of the Corsican town of Sisco said he wouldn’t lift the ban he imposed after an Aug. 13 clash on a beach.

“Here the tension is very, very, very high and I won’t withdraw it,” Ange-Pierre Vivoni said on BFM-TV.

He said he doesn’t know whether a woman was actually wearing a burkini the day a clash occurred that set a group of Corsican sunbathers of North African origin against villagers from Sisco. It took days to untangle the events leading to the violence that many immediately assumed was over a burkini sighting.

The bans have become a symbol of tensions around the place of Islam in secular France.

Many officials —including Prime Minister Manuel Valls — have argued that burkinis oppress women. But critics say the bans were feeding a racist political agenda as campaigning for next year’s French presidential elections were kicking off.