The United Nations and the White House seemed relieved by the ruling.

“Obviously we welcome the decision by the court,” Secretary General Ban Ki-moon’s chief spokesman, Stéphane Dujarric, who had expressed concern about the burkini ban, said at a news briefing, emphasizing “the need for people’s personal dignity to be respected.”

Josh Earnest, a White House spokesman, said the United States did not want to “second-guess” France, but noted that President Obama “believes strongly in the freedom of religion.”

Critics of the bans have said they unfairly targeted Muslims in the wake of deadly terrorist attacks in France and elsewhere in Europe. The bans provoked a backlash, particularly photographs spread online showing armed police officers confronting women wearing burkinis, or other clothing — like a veil, a tunic and leggings — covering most of the body.

Patrice Spinosi, a lawyer for the Human Rights League, one of the groups that had challenged the ban, said his association would now ask mayors in other towns to withdraw their bans.

“The council has ruled and has showed that mayors do not have the right to set limits on wearing religious signs in public spaces,” he said, in the absence of a demonstrated threat to public order. “It is contrary to the freedom of religion, which is a fundamental freedom.”

Villeneuve-Loubet, a seaside resort of about 14,000, adopted the ban on Aug. 5, and it was supposed to end on Sept. 15. Police officers in the town will no longer be able to issue fines for burkini-wearing, and women who received fines will be able to contest them.

Villeneuve-Loubet sits between Nice and Cannes, which enacted a burkini ban on July 28. Most of the prohibitions are temporary and run until the end of the holiday season.