I spent seven years of my girlhood heavily veiled - not in a Muslim niqab but in a nun's habit. We wore voluminous black robes, large rosaries and crucifixes, and an elaborate headdress: you could see a small slice of my face from the front, but from the side I was entirely shielded from view. We must have looked very odd indeed, walking dourly through the colourful carnival of London during the swinging 60s, but nobody ever asked us to exchange our habits for more conventional attire.

When my order was founded in the 1840s, not long after Catholic emancipation, people were so enraged to see nuns brazenly wearing their habits in the streets that they pelted them with rotten fruit and horse dung. Nuns had been banned from Britain since the Reformation; their return seemed to herald the resurgence of barbarism. Two hundred and fifty years after the gunpowder plot, Catholicism was still feared as unassimilable, irredeemably alien to the British ethos, fanatically opposed to democracy and freedom, and a fifth column allied to dangerous enemies abroad.

Today the veiled Muslim woman appears to symbolise the perceived Islamic threat, as nuns once epitomised the evils of popery. She seems a barbaric affront to hard-won values that are essential to our cultural identity: gender equality, freedom, transparency and openness. But in the Muslim world the veil has also acquired a new symbolism. If government ministers really want to debate the issue fruitfully, they must become familiar with the bitterly ironic history of veiling during the last hundred years.

Until the late 19th century, veiling was neither a central nor a universal practice in the Islamic world. The Qur'an does not command all women to cover their heads; the full hijab was traditionally worn only by aristocratic women, as a mark of status. In Egypt, under Muhammad Ali's leadership (1805-48), the lot of women improved dramatically, and many were abandoning the veil and moving more freely in society.

But after the British occupied Egypt in 1882, the consul general, Lord Cromer, ignored this development. He argued that veiling was the "fatal obstacle" that prevented Egyptians from participating fully in western civilisation. Until it was abolished, Egypt would need the benevolent supervision of the colonialists. But Cromer had cynically exploited feminist ideas to advance the colonial project. Egyptian women lost many of their new educational and professional opportunities under the British, and Cromer was co-founder in London of the Anti-Women's Suffrage League.

When Egyptian pundits sycophantically supported Cromer, veiling became a hot issue. In 1899 Qassim Amin published Tahrir al-Mara - The Liberation of Women - which obsequiously praised the nobility of European culture, arguing that the veil symbolised everything that was wrong with Islam and Egypt. It was no feminist tract: Egyptian women, according to Amin, were dirty, ignorant and hopelessly inadequate parents. The book created a furore, and the ensuing debate made the veil a symbol of resistance to colonialism.

The problem was compounded in other parts of the Muslim world by reformers who wanted their countries to look modern, even though most of the population had no real understanding of secular institutions. When Ataturk secularised Turkey, men and women were forced into European costumes that felt like fancy dress. In Iran, the shahs' soldiers used to march through the streets with their bayonets at the ready, tearing off the women's veils and ripping them to pieces. In 1935, Shah Reza Pahlavi ordered the army to shoot at unarmed demonstrators who were protesting against obligatory western dress. Hundreds of Iranians died that day.

Many women, whose mothers had happily discarded the veil, adopted the hijab in order to dissociate themselves from aggressively secular regimes. This happened in Egypt under President Anwar Sadat and it continues under Hosni Mubarak. When the shah banned the chador, during the Iranian revolution, women wore it as a matter of principle - even those who usually wore western clothes. Today in the US, more and more Muslim women are wearing the hijab to distance themselves from the foreign policy of the Bush administration; something similar may well be happening in Britain.

In the patriarchal society of Victorian Britain, nuns offended by tacitly proclaiming that they had no need of men. I found my habit liberating: for seven years I never had to give a thought to my clothes, makeup and hair - all the rubbish that clutters the minds of the most liberated women. In the same way, Muslim women feel that the veil frees them from the constraints of some uncongenial aspects of western modernity.

They argue that you do not have to look western to be modern. The veiled woman defies the sexual mores of the west, with its strange compulsion to "reveal all". Where western men and women display their expensive clothes and flaunt their finely honed bodies as a mark of privilege, the uniformity of traditional Muslim dress stresses the egalitarian and communal ethos of Islam.

Muslims feel embattled at present, and at such times the bodies of women often symbolise the beleaguered community. Because of its complex history, Jack Straw and his supporters must realise that many Muslims now suspect such western interventions about the veil as having a hidden agenda. Instead of improving relations, they usually make matters worse. Lord Cromer made the originally marginal practice of veiling problematic in the first place. When women are forbidden to wear the veil, they hasten in ever greater numbers to put it on.

In Victorian Britain, nuns believed that until they could appear in public fully veiled, Catholics would never be accepted in this country. But Britain got over its visceral dread of popery. In the late 1960s, shortly before I left my order, we decided to give up the full habit. This decision expressed, among other things, our new confidence, but had it been forced upon us, our deeply ingrained fears of persecution would have revived.

But Muslims today do not feel similarly empowered. The unfolding tragedy of the Middle East has convinced some that the west is bent on the destruction of Islam. The demand that they abandon the veil will exacerbate these fears, and make some women cling more fiercely to the garment that now symbolises their resistance to oppression.

· Karen Armstrong is the author of Muhammad: Prophet for Our Time comment@theguardian.com