When Aheda Zanetti invented the burkini, it was about fitness and fun, she says. This was in Australia in 2004, and the idea was to find a way for Muslim girls and women to participate in and enjoy the country's beachy, sporty lifestyle.

This was the sunny, hopeful origin of a garment now banned in 15 French coastal resorts - a ban that was enforced in Nice last week by four armed male police officers compelling a conservatively dressed Muslim woman on a beach to remove layers of clothing.

As her daughters cried and bystanders cheered, the 34-year-old woman was fined for not wearing "an outfit respecting good morals and secularism".

Mainstreaming far-right

This militant enforcement of "good morals" sparked widespread condemnation and France's highest court has since suspended the ban - although some mayors have already said they intend to ignore this decision.

The French Socialist Prime Minister Manuel Valls defended the ban, enforced in over a dozen coastal cities, describing a "battle of cultures" and denouncing the swimwear as symbolising the enslavement of women.

Meanwhile, former President Nicolas Sarkozy launched his new presidential election campaign days ago by calling for a full burkini ban, warning that minorities and migrants were threatening to destroy French identity.

And so we have a European country that prides itself on being liberal-minded now focusing its politics, across the spectrum, on telling women what to wear. Which, by the way, is what happens when you pander to the far-right, as French politicians are doing - mainstreaming outright racism instead of holding a line against it.

Wave of terrorist attacks

Of course, none of this is happening in a vacuum: France has been shaken by a devastating wave of deadly terrorist atrocities.

The country is collectively mourning 86 people horribly killed when a truck was deliberately driven into Nice's Promenade des Anglais on July 14.

Later that month, an 86-year-old priest was stabbed to death in an attack claimed by the Islamic State of Iraq and the Levant (ISIL, also known as ISIS).

Rather than being about an equality-driven, French Republic commitment to secularism, the burkini ban seems to derive more from ideas percolated around French colonialism in North Africa - where so many of its Muslim citizens have roots.

France suffered its worst terrorist attack in November last year when more than 100 people were killed in a series of coordinated shootings and suicide bombings, including 90 killed during a siege of the Bataclan concert hall. In January that same year, 12 people were murdered in an attack on the satirical magazine Charlie Hebdo in Paris.

Burkini-banning officials have cited security concerns, viewing the beachwear as part of the violent assault on France from Islamist extremism.

The ban is also on a continuum of measures taken in the name of laicite - the French-style secularity underpinning the country's political and cultural identity: The full Islamic veil, for instance, was banned in 2011.

Built-in assumption of superiority

When people are still reeling from horrifying acts of violence, when extremist recruiters are on the prowl and when community cohesion is so strained, it is more important than ever to examine the motives behind such bans.

French history - the necessity of keeping the Catholic Church out of politics - is typically cited as the context for its commitment to laicite, but is this what actually informs the current debate?

OPINION: Far-right feasts on France's unchecked Islamophobia

Listening to Nice's deputy mayor Rudy Salles talk about the issue on BBC radio last week - and his words echo those of other French politicians - it's hard to believe this is the case. Describing the burkini as a "provocation from Islamists", he claimed to be fighting for the freedom of women, while wanting to help people "to be integrated [into] this society".

But the problem with this approach, of forcing citizens to choose between identities - are you French or Muslim? - isn't just that it suggests an intolerance of difference, or represents a false binary.

It's that such demands carry a built-in assumption of superiority: You would only dictate such terms if you thought that the obvious, sensible preference would be for French values over a communitarian Muslim identity.

Colonial stigma

Rather than being about an equality-driven, French Republic commitment to secularism, the burkini ban seems to derive more from ideas percolated around French colonialism in North Africa - where so many of its Muslim citizens have roots.

The hijab, at that time, was derided, seen as a symbol of Islamic oppression and a part of what made North African countries so inferior.

OPINION: Hello and welcome to the hijabi Olympics

That was the logic that underpinned and justified French colonisation of the region - but more than that: The hijab was as much a fixation then as it has become now. In Algeria, for example, the unveiling of women was a way of showing how France was liberating its female subjects from the repressive tyrannies of Islam - and so, keeping the veil on, in mirror image, in some cases became a symbol of resisting colonial rule.

This "mission civilisatrice" saw a moral duty in colonisation: A self-elevating sense of responsibility to educate and liberate populations across North Africa.

And there are unmistakable echoes of this sentiment in the words of some French politicians and feminists, who see veiled Muslim women as, by definition, oppressed and in need of saving.

It's also there in the irony of wanting these apparently "oppressed" Muslim women to be visible, to have a voice - but not actually giving the same women a voice or any agency in this debate.

France is not unique in its reluctance to absorb the realities of its past; nations with older legacies of empire, settlement and occupation are still struggling to do so.

But this may account for what, from the outside at least, looks like a clear case of bad wiring: A failure to acknowledge that colonialism, not secularism, is driving so much of this debate over women's clothing today.

And it's also in part the reason that the "secular" justification for and enforcement of the burkini ban comes over as fundamentalist in a way that arguments premised purely on a commitment to religion-blind equality could not.

Equality and freedom, after all, are not rights that you impose upon people against their will.

Rachel Shabi is a journalist and author of Not the Enemy: Israel's Jews from Arab Lands.

The views expressed in this article are the author's own and do not necessarily reflect Al Jazeera's editorial policy.