The European Court of Justice (ECJ) has ruled that employers can ban staff from wearing religious symbols at work.
But the ban on the "visible wearing of any political, philosophical or religious sign" must be based on internal company rules requiring all employees to "dress neutrally", it ruled.
It said the rule cannot be imposed because of customer complaints.
It is the court's first ruling on the issue of people wearing religious symbols including Muslim headscarves at work.
The court ruled on cases brought by a French woman and Belgian woman, who had refused to remove their headscarves at work.
The Belgian woman, Samira Achbita, was sacked in 2006 from company G4S Secure Solutions, which has a ban on religious symbols being worn by employees, after refusing to remove her headscarf.
French woman Asma Bougnaoui was sacked from her IT consultancy position after refusing to remove her headscarf following a complaint from a customer.
The court upheld the right of thye company to ban religious attire among employees in the first case. In the second it found customer complaints did not give companies a get-out clause from EU anti-discrimination law, but did not rule on whether Bougnaoui's dismissal was based on her failure to observe company policies, saying this was a matter for the French court to determine.