A Muslim primary school teacher has lost her bid to overturn a law banning the wearing of religious clothing by public servants in Berlin.
The Berlin labour court judge ruled that the city-state's neutrality law for teachers, police and court officials was constitutional.
Germany's 16 states have differing laws on headscarves in schools.
Three years ago Germany's constitutional court overturned a blanket ban on teachers wearing them.
The federal court cited religious freedom, although civil servants across Germany are barred from covering their faces. The full face-veil is not allowed on a national level but the hijab is.
Germany's patchwork laws on headscarves
Since the 2015 federal ruling each state has devised its own rules for Muslim teachers.
The teacher in Berlin worked at the primary school for only a day before being assigned to a college where she was allowed to wear the headscarf.
And the headscarf issue has become controversial in several German states.
Police were called in recently when a head teacher at a primary school in the state of Hesse provoked a storm of abuse. She had written to parents telling them that wearing headscarves and other coverings was not allowed in the classroom.
In Bremen, in the north west, teachers are allowed to wear headscarves, while in North Rhine-Westphalia the issue is decided on a case-by-case basis. The western state is proposing a ban on girls under 14 wearing headscarves in schools.
The Berlin case has prompted widespread reaction in the German capital.
Wednesday's ruling has been welcomed by the founder of Berlin's liberal mosque, Seyran Ates, who has campaigned to keep religious symbols out of schools.
But Zeynep Cetin of the Network Against Discrimination and Islamophobia argued that the ruling was like a professional ban on the female teacher involved.
Berlin Mayor Michael Müller has expressed his support for Berlin's neutrality law but a Green party politician said he wanted it changed.
A Muslim teacher won a separate case in Berlin last year, when the same labour court ruled that a school had broken anti-discrimination laws by refusing her a job. The school had been unable to prove that the headscarf was a "threat to peace at the school".