Employers can ban workers from wearing headscarves, crucifixes and other religious clothing, the European Union's top legal adviser said.
G4S, the security firm, did not breach EU anti-discrimination laws when it fired a Belgian Muslim receptionist who wanted to cover her head, it was argued.
Company dress codes that ban religious clothing are legal in the EU as long as they apply to all faiths and political views equally, it was said.
Juliane Kokott, the European Court of Justice's advocate general, issued the opinion which gives a strong indication of how Europe's top court will eventually rule.
Previous rulings on religious dress codes have come from the European Court of Human Rights in Strasbourg, which is not part of the EU. In 2013, the ECHR ruled that a British Airways hostess had a right to wear the cross at work.
Kokott said that G4S was entitled to dismiss Samira Achbita after she flouted an internal uniform policy by announcing she would wear a headscarf at work, saying that the company had a right to a "policy of strict religious and ideological neutrality".
"There is nothing in the present case to indicate that an individual was 'treated less favourably'," she wrote.
"A company rule such as that operated by G4S could just as easily affect a male employee of Jewish faith who comes to work wearing a kippah, or a Sikh who wishes to perform his duties in a turban, or male or female employees of a Christian faith who wish to wear a clearly visible crucifix or a T-shirt bearing the slogan 'Jesus is great' to work," Kokott wrote.
There was no obligation on the company to find her a back-office job, or to introduce a co-ordinated headscarf into its uniform code, Kokott said - saying such a move would "undermine" the company's policy.
The fact that a receptionist's job can be performed "just as well with a headscarf as without one" does not prevent such policies being set, she added.
"While an employee cannot 'leave' his sex, skin colour, ethnicity, sexual orientation, age or disability 'at the door' upon entering his employer's premises, he may be expected to moderate the exercise of his religion in the workplace," she said.
Kokott said that claims banning headscarves would prevent Muslim women from finding jobs and integrating into society was "sweeping assertion", given that Achbita had worked at G4S for three years before adopting the headscarf.
The opinion makes clear that G4S did not incorporate its previously "unwritten" ban into official company policy until the day after it fired Achbita in 2006.
Kokott noted that the debate was of huge "social sensitivity" as Europe grapples with how to integrate a major influx of Muslim migrants.