Muslim teachers may not teach in state schools while wearing a headscarf, the country's highest administrative court has ruled.
Teachers who refuse to remove their headscarf cannot be given permanent teaching posts, the court in Berlin said, upholding the decision of lower courts.
The case of Fereshta Ludin vs the state education authority in Baden-Wuerttemberg, where she qualified as a teacher, has been an important test case for freedom of religious belief among teachers.
The court saw the scarf as a political and religious symbol that would breach the carefully guarded neutrality of all public-sector workers.
While nuns in church schools are allowed wimples and priests can wear habits, the ruling is effectively a country-wide ban against headscarves for Muslim teachers.
Ms Ludin, 30, was born in Afghanistan and came to Germany as a child. She is now a German citizen. Five years ago she was barred from teaching in Baden-Wuerttemberg state after she refused to take her scarf off while teaching.
She has been teaching at a private Muslim school in Berlin - one of only two in the country - while awaiting the ruling.
The court said a civil servant's duty to observe ideological neutrality overrode their rights to personal religious freedom. "The obligation for strict neutrality in state schools is contravened when a teacher wears a headscarf during lessons," the court said.
The judge said that the headscarf was a political as well as a religious symbol which had no place in the classroom.
As to Ms Ludin's right to freedom of religion, pupils also had "a right not to be subjected to the influence of an alien religion, including in the form of religious symbols, without having the right to withdraw from the lesson".
Ms Ludin's lawyers argued the headscarf was not a "religious advertisement" but a dress preference, no different from wearing lederhosen in Bavaria.