Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

LONDON — Europe’s highest court ruled Tuesday that employers are allowed to ban workers from wearing visible political or religious symbols including Islamic headscarves.

In its first direct judgment on the topic, the European Court of Justice said a workplace rule prohibiting any such item “does not constitute direct discrimination” if applied universally.

The decision, which applies to all 28 countries in the bloc, came in in two cases including one brought by a Muslim receptionist in Belgium employed by contracting giant G4S.

The Islamic headscarf has been at the center of controversy in a number of European countries, most notably France which attaches particular importance to the separation of religion and government services such as schools.

Women look at veils on display at an exhibition hall during the Muslim World Fair in Le Bourget, France, on Dec.17, 2011. Christophe Ena / AP

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

The judges said a workplace ban on visible symbols would not be discriminatory if it covered “any manifestation of beliefs without distinction.”

There is a risk of indirect discrimination if certain groups were unfairly impacted, but this could be justified if the rule was “appropriate and necessary,” the judges notes.

The ruling came on the eve of an election in the Netherlands which has seen fierce debate over the impact of immigration and the rise of visible religious clothes.

The receptionist, Samira Achbita, was fired in 2006 after deciding she would wear an Islamic headscarf to work, “contrary to the position of neutrality G4S adopted in its contacts with its customers,” the ECJ said.

She sued for wrongful termination but the court concluded such a ban would be “appropriate for the purpose of ensuring that a policy of neutrality is properly applied, provided that that policy is genuinely pursued in a consistent and systematic manner.”

Islamic headscarves have become an issue in this week's Dutch elections. Peter Dejong / AP

However, the court ruled in the second case that an employer could not cite customers’ preferences not to be served by a worker in a headscarf as way to avoid discrimination law.

The case in involved a French software designer, Asma Bougnaoui, who was fired in 2008 after a customer complained she was wearing a veil.

“The willingness of an employer to take account of the wishes of a customer no longer to have the services of that employer provided by a worker wearing an Islamic headscarf cannot be considered a genuine and determining occupational requirement,” the ECJ said.

In 2013, Coptic Christian Nadia Eweida, from London, won a case at the parallel European Court of Human Rights after she was banned by British Airways from wearing a visible cross while in uniform. The court ruled the airline had failed to strike a balance between corporate image and articles 9 and 14 of the European Convention on Human Rights which protect "freedom of thought, conscience and religion" and prohibit religious discrimination.

Last summer, some cities in France — including the seaside resort of Cannes — banned burkinis, the full-body swimsuits worn by some Muslim women, from beaches. The move came after the terror attack in Nice where more than 80 people died.