When Egypt's government banned Islamic veils and all-encompassing robes in the dorms of public universities, it cited reports of men wearing the garb to sneak into the women's quarters.
But there was a deeper reason behind the move: an intensifying struggle between the moderate Islam championed by the state and a populace that is turning to a stricter version of the faith, whose most visible hallmark is the niqab _ the dress that covers the entire female form.
The debate has grown more heated since Mohammad Tantawi, the top cleric at prestigious Al-Azhar University, banned the niqab in classrooms and dorms on the grounds that it "has nothing to do with Islam," and that it was unnecessary since the college is gender-segregated. Meanwhile, the Health Ministry and religious authorities forbade nurses and preachers to wear the niqab.
The moves have angered many women who say they cover up voluntarily out of religious conviction, and in some cases are penalized for it.
Fatma al-Assal, 22, has just earned her veterinary degree and says she has already been refused a teaching job. But she refuses to back down.
"Al-Azhar has no authority over me," she said.
Like her mother and two younger sisters, she covers everything including her hands. Dressed that way, "I feel respect. I don't have anyone looking at me," she said. "Islam says all the woman's body is a temptation."
She said she takes her example from what many Muslims believe was the dress code in the time of Muhammad, who founded their religion nearly 1,400 years ago. "I want to emulate the wives of the prophet."
In European countries, particularly France, the debate over women's dress has turned on questions of how to integrate immigrants and balance a minority's rights with secular opinion that the garb is an affront to women.
But in Egypt, the dynamic is different. Here, public conservatism is at odds with a government that is viewed not only as secular but as autocratic, corrupt and uncaring.
The debate underscores the gulf between the more secular elite that wields economic and political power, and the largely impoverished and disenfranchised masses who increasingly find solace in religion.
The split was evident last month when billboards of a swimsuited Beyonce were plastered all over Cairo to advertise the American singer's concert at Egypt's most exclusive beach resort _ a concert the vast majority of Egyptians couldn't afford to attend.
One conservative lawmaker branded it an "insolent sex party." Another called for banning the "nudity concert," and an anti-concert petition on Facebook gathered 10,000 supporters. The concert went ahead without incident in the remote resort under heavy security protection.
A decade ago, the niqab was almost never seen in Egypt and it is still a minority fashion. Most women wear a scarf that covers the hair but not the face, often with tight jeans or clinging tops, despite clerics' complaints that formfitting clothes violate the whole point of "Islamic dress."
But today it is normal to see women in niqab, hidden under a veil that covers everything but the eyes, billowing black robes that cloak the body's shape, and often gloves. They are found at universities, teaching in schools, working in government offices and private companies, strolling along the Nile and riding on motorcycles behind their husbands.
The inspiration is Salafism, a movement that models itself on early Islam. Its doctrine is similar to Saudi Arabia's, and many trace its spread to Egyptians returning home from work in the kingdom and to Saudi-backed religious satellite TV stations.
Salafi groups are nonpolitical and shun the violent teachings that drove Egypt's Islamic insurgency in the 1990s. Still, they provide financial, medical and charity services that are an attractive alternative to the state's poor services. Moreover, Salafi ideology _ including wearing the niqab _ is increasingly attracting more affluent followers.
That has the government fearing a loss of control.
"This is not a security battle. It is a cultural, political battle," said Diaa Rashwan, an analyst who monitors such groups. "There is no cohesion within the state on how to tackle it."
For some women, particularly the young, covering up is an implicit rebellion against the system. And despite the West's notion of Muslim women being oppressed and cloistered, many of them are outspoken in defending their beliefs.
"I tell a girl who wants to wear the niqab that she has to be ready to fight for it," said al-Assal's mother, Iman el-Shewihi, who veiled herself 15 years ago _ the first in her family to do so.
The 45-year-old woman, who is working on her doctorate in Islamic law, says that like her daughter, she has paid a price; She has been denied teaching jobs at her university in Tanta, north of Cairo.
The wearing of veils has spread in other secular-leaning Arab countries such as Jordan, Syria and Lebanon. But today Egypt, which used to be the Arab world's wellspring of secular thinking and lifestyle, is considered much more conservative than the others. It is also the only country actively trying to curb the veil, although Jordan's government tries to discourage it by playing up reports of robbers who wear veils as masks.
In addition to the Education Ministry's order for dorms, some public universities have barred the veil during exams, saying that male students sometimes disguise themselves in the garb to take tests for female friends.
Tantawi, the government-appointed Al-Azhar cleric, stirred a furor with his niqab ban in October. Besides the university, Al-Azhar runs a network of religion-based secondary schools separate from the public system.
He won backing from state media run by pro-government liberal businessmen, which depicted the veil as a sign of spreading extremism. "There has to be a firm stand on this," said Abdullah Kamal, a ruling party member and editor-in-chief of Rose Al-Youssef, a government-funded newspaper.
Some job postings on the Internet explicitly rule out veiled women, and many social clubs and glitzy restaurants bar them.
Tantawi was accused by a cleric on a TV talk show of "participating in a crusade against Islam," and there were demands for his resignation. He has since tried do damage-control, insisting in interviews that he respects the niqab. But his prohibition stands.
A group of women, backed by human rights group, is suing the government for denying them subsidized housing in the dorms.
One of them is Iman, a veiled medical student who joined other women in street protests and says she was roughed up by security agents. She spoke to The Associated Press on condition of anonymity, fearing further government harassment.
She said five of her colleagues shed their veils so they could live in the dorms, and her father, a farmer, is pressing her to do the same. But she has chosen to keep her veil and rent an apartment, even though it costs three times as much as a dorm.
"I don't need them anymore," she says of the government. "They will not be able to break me."