Some observers think the verdict may bode ill for the government in a separate case in which Turkey’s chief prosecutor is seeking to disband the AK Party because it is “the focal point of anti-secular activities”.
The prosecution also seeks to ban 71 members, including the prime minister and the president, from belonging to a political party for five years.
The Turkish lira weakened against the dollar on the news, with markets fearing prolonged political uncertainty in the European Union-applicant country.
Cemil Cicek, the deputy prime minister, was reported as saying he would comment once he had read the court’s ruling.
“We must see the justification for the decision,” Cicek, who is also a government spokesman, said.
Neslihan Akbulut, a 27-year-old activist who wears a headscarf, said she was not shocked by the ruling but felt “very sad” for Turkey.
“For ten years I have experienced this ban in my country,” she said.
“The judges in the constitutional court are behaving like they are governing the country … But we have not elected those judges.”
They are actually ruling against the constitution, Akbulut said, “because they are saying that women with headscarves are not equal.”
“It will be a disaster for students here … They can’t just move abroad, they’re students, they live here. This decision affects their whole life.”
Another female student, who does not wear the headscarf, said it should be banned at universities.
“Frankly, I’m saying this based on the secular state principle because it’s used as a political symbol, it’s not a religious freedom. That’s why, as a student of law, I don’t want it to be allowed at universities,” Ezgi Tuncer said.
In February, parliament passed constitutional amendments abolishing the ban, and allowing headscarves.
The secular opposition immediately appealed the ruling at the top court.
Lifting the headscarf ban was one of the most significant moves on religious issues in predominantly Muslim but secular Turkey since a military coup in 1980 that led to a crackdown on individual rights.
The secularist establishment, which includes army generals, judges and university rectors, fears ending the ban would undermine secularism, one of the founding principles of the modern Turkish republic.
The AK Party, which was re-elected last year with 47 per cent of the vote, says the right to wear the headscarf at university is a personal and religious freedom.