ISTANBUL, Turkey — For years Zeynep Nur Incekara, a young medical student at Istanbul University, attended classes in a hat, or sometimes a wig — substitutes for the Islamic headscarf, or hijab, that is forbidden in public buildings in Turkey.

After being barred from class twice last year for opposing the school’s dress code, Incekara took action. Writing to the Prime Ministry Human Rights Directorate, she complained that her right to education was being restricted and demanded that something be done, bringing her, albeit reluctantly, into the center of the political maelstrom.

Incekara’s letter was turned over to Turkey’s Higher Education Board, or YOK, which ruled that she could not be kicked out of classes for “acting against the disciplinary regime.”

“Let alone a hat, we are against anybody being sent out of the classroom for any way of dressing,” said Yusuf Ozcan, president of YOK, in comments to Turkey’s NTV television channel, adding that they would notify any universities that failed to comply with the directive.

YOK’s ruling is just the latest installment in the ongoing battle between Turkey’s rising Islamic middle class and a militantly secular establishment that is not used to compromising their ideals.

For most women living in a Muslim-majority country, the decision to cover ones head would be a non-issue, in a few it is a requirement. But in Turkey — a predominantly Muslim country whose identity is built on secularism — the choice to cover one’s head is politically charged.

Over time the headscarf has come to represent a fear held by some of the more secular divisions of Turkish society that any weakening of the state’s founding principles, laid down by its founding father, Mustafa Kemal Ataturk, could leave them exposed to Islamization.

“The headscarf as an object is perceived differently by different policy actors,” said Ozge Genc, head of the Religion, State and Society project at Tesev, an Istanbul-based think tank. “Some of them perceive it as a political symbol, some of them as a symbol of piety, some of them perceive it as a human right.”

The headscarf issue has been simmering here since the 1960s, when a student wearing a headscarf was first prevented from entering a university, finally reaching a full boil in 1997 when the coalition government headed by the Islamic Welfare Party was forced from power and the ban that had existed in theory became more strictly enforced.

Two years ago, when the governing Justice and Development Party, or AKP, which has roots in political Islam, tried to lift the ban, Turkey’s top court struck down the proposed law as a threat to the country’s secularism — and soon after came within one vote of banning the AKP itself.

YOK’s directive, rather than being a turning point in and of itself, is in some ways simply recognition of a trend that has been quietly evolving outside the headlines for some time. At an increasing number of Turkish universities women are being given, to varying degrees, the right to wear headscarves.

Turkish daily newspaper Radikal published a list of eight universities that don’t enforce the no-headscarf rule, 31 where headscarves are allowed on campus but not in the classrooms and 29 that strictly enforce the rule. Where and when the ban is applied, however, remains a gaping unknown, frowned upon by some segments of society, fought for by others, and ultimately applied indiscriminately.

The university ban is not officially specified in Turkey’s constitution or laws, which do, in fact, call for freedom of clothing. But through a tricky piece of legal interpretation coined “interpretative refusal,” the headscarf has always fallen into a gray area.

YOK’s directive, while applauded by those working to end the ban, falls short of solving the headscarf issue. Some see last month’s constitutional referendum, which is shaking up the traditionally secular constitutional court and expanding the process of judicial appointments, as another opportunity to officially end the headscarf ban. Others remain skeptical.

“YOK’s answer is progressive because it recognizes that the headscarf ban is not based on the law; that it is arbitrary,” said Fatma Benli, a Turkish lawyer and human right’s advocate who is defending Zeynep. “But of course it is not enough.”

Benli, who wears a headscarf herself, is more aware than most of the official and unofficial barriers the ban puts in the way of covered women’s academic and professional successes.

“[Because] I could not defend my master’s thesis in front of the jury I had to quit school. I became a lawyer and although I have my own office I still cannot attend my own trials, or use my rights in law as a normal person.”

Turkey’s public sector bans government workers from wearing headscarves, limiting the employment opportunities for women to private-sector companies, according to a study about to be released by Tesev.

“What I see is that removing the headscarf ban in university will, overtime, become a consensus, be it formally or more informally,” said Genc. “But in terms of public sector this is a much bigger war.”