A controversial ban on the burkini was overturned by France's highest administrative court on Friday (Saturday NZ time), prompting a Right-wing backlash as mayors vowed to defy the ruling.
The State Council's judgment suspended a ban in the Riviera resort of Villeneuve-Loubet and set a legal precedent for about 30 other towns that have also prohibited the full-body swimsuit worn by a minority of Muslim women.
The council ruled that mayors overstepped their powers by introducing the bans this month amid growing anxiety over security after a series of terrorist attacks including the Bastille Day massacre of 86 people in Nice.
"The emotion and the anxieties resulting from the terrorist attacks and especially the one committed in Nice on July 14, are not sufficient to justify legally the prohibition," the judgement said.
The ban "constituted a serious and manifestly illegal infringement of fundamental liberties", it said, ruling that mayors "may only restrict freedoms if there are confirmed risks" to public safety, which it said was not the case with the burkini.
Lionnel Luca, the mayor of Villeneuve-Loubet, said: "This decision, far from pacifying, will serve only to heighten tensions which will carry risks of trouble which we wanted to avoid."
He argued that the judgment was inconsistent as another Riviera town, Mandelieu-la-Napoule, introduced an identical ban in 2013 that was never contested.
"Rampant Islamism has been gaining ground. With this ruling it has gained some more," Mr Luca added.
He said he would comply with the ruling, but other local authorities, including the mayor of Sisco, in Corsica, vowed to maintain their bans.
"This judgment does not affect us here because we had a fight over it [the burkini]," said Ange-Pierre Vivoni, referring to a brawl on a beach in Sisco on August 13 which preceded the ban.
Mayors who contest the ban will be backed by Nicolas Sarkozy, the former conservative president who introduced France's ban on the Islamic full-face veil five years ago.
He demanded a nationwide burkini ban this week, placing Islam, immigration and security at the heart of his campaign to win back power from the Socialists in elections next year.
An ally of Mr Sarkozy, Guillaume Larrivé, said: "We support 100 per cent the mayors who introduced bans."
He said parliament could still pass a law banning the burkini, which a poll suggested would be backed by two-thirds of French people.
Florian Philippot, deputy leader of the far-Right Front National, accused Mr Sarkozy of "poaching ideas from the FN to dupe our voters into backing him".
Support for the bans is not confined to the Right.
The Socialist prime minister, Manuel Valls, has described the burkini as a "symbol of the enslavement of women" unacceptable under France's secular constitution.
"Denouncing the burkini is not jeopardising an individual freedom. There is no freedom that locks up women! It's denouncing a deadly, backward Islam," he wrote on his Facebook page on Friday.
However, opponents of the bans, who include the Moroccan-born education minister, Najat Vallaud-Belkacem, have argued that they only served to fuel a racist political agenda as the election campaign kicks off.
The court's decision was welcomed by the French Muslim Council, which described it as a "victory for the law and wisdom ... that should make it possible to reduce tension".
Feiza Ben Mohamed of a Muslim group based in Nice said it "gives Muslim women back their dignity".
Asked if it meant burkini-clad women would throng the town's beach, she laughed and said: "There were hardly any there before the ban so I don't see why they should turn up there now."
There was outrage in Britain and around the world after photographs emerged showing armed police apparently compelling a woman on a beach in Nice to remove a long-sleeved top - although she was not in a burkini.
Mayors of the towns that prohibited the Islamic swimsuit justified the bans on the grounds of public order and safety, hygiene or secularism.
Religion and public life are strictly separated in France, which was the first European country to ban the Islamic full-face veil in 2011.
However, few women in France wear the veil or the burkini, and only two towns, Nice and Cannes, have fined women for wearing it.
Amnesty International praised the court's ruling. "By overturning a discriminatory ban that is fuelled by and is fuelling prejudice and intolerance, today's decision has drawn an important line in the sand," said John Dalhuisen, its Europe director.
Critics compared the enforcement of the ban to repression in Saudi Arabia and Iran, where religious police enforce strict dress codes on women.
Some rights groups have said the new bans amounted to "collective punishment" of Muslims after the terror attacks amid growing friction over immigration.
Terrorism analysts warned that the bans were feeding jihadist propaganda and could help Isil recruit new members.
Marine Le Pen, leader of the FN, described the court's ruling as "obviously regrettable but not surprising."
She urged parliament to vote to ban the burkini "in order to protect women, secularism and our way of life."
With the exception of the prime minister, the ruling was welcomed by the Socialists.
Razzy Hammadi, the party spokesman, said he hoped it would "put an end to this nasty controversy".