LONDON — The European Court of Human Rights has upheld a ban imposed by France on the wearing of face-covering veils in public, rejecting arguments that the measure violates religious freedoms and bolstering opponents of strict Islamic dress in other parts of Europe.

The ban, which went into effect three years ago in France, has been contentious because it set the authorities on a collision course with Muslims who said the wearing of such veils by women was an obligation of their faith.

The ban, imposed by the former conservative government of Nicolas Sarkozy, was also depicted by its critics as exploiting anti-Muslim and anti-immigrant sentiments in a country with a Muslim minority estimated at up to six million — Europe’s largest.

At the European Court of Human Rights in Strasbourg, France, judges said on Tuesday that the ban was a legitimate attempt to preserve the norms of France’s diverse society and that it did not infringe on Europe’s Convention on Human Rights. The court was ruling on a case brought by an unidentified Frenchwoman who said the law was discriminatory and violated her freedom of conscience. The 24-year-old woman, a college graduate, had requested anonymity for fear of reprisals if her identity became known.