In the first case of its kind, the European Court of Justice (ECJ) has ruled that employers are allowed to ban employees from wearing visible religious, political and philosophical symbols in the workplace.

However, such a ban has to be based on internal company rules dictating that employees “dress neutrally” and cannot be based on “the wishes of a customer”, the ECJ stipulated.

“An internal rule of an undertaking which prohibits the visible wearing of any political, philosophical or religious sign does not constitute direct discrimination,” the court said in a statement.

“However, in the absence of such a rule, the willingness of an employer to take account of the wishes of a customer no longer to have the employer’s services provided by a worker wearing an Islamic headscarf cannot be considered an occupational requirement that could rule out discrimination.”

#ECJ: no direct discrimination if internal company rule prohibits wearing of religious symbols https://t.co/B0sMPtNgss — EU Court of Justice (@EUCourtPress) March 14, 2017

The ECJ ruling was based on court cases brought by two female employees in Belgium and France, who were dismissed for refusing to remove their Islamic headscarves.

The headscarf and other religious symbols are a contentious issue in a number of European countries. France, in particular, attaches importance to the separation of Church and State.

Its far-right National Front party is expected to perform strongly in presidential elections this spring.

The ruling comes a day before the Netherlands goes to the polls in a parliamentary election dominated by issues of immigration and integration.