Employers may bar staff from wearing visible religious symbols, the European Union’s top court ruled on Tuesday in its first decision on the issue of women wearing Islamic headscarves at work.

On the eve of a Dutch election in which Muslim immigration has been a key issue and a bellwether for attitudes to migration and refugee policies across Europe, the Court of Justice (ECJ) gave a joined judgment in the cases of two women, in France and Belgium, who were dismissed for refusing to remove headscarves.

“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.”

The judgment in the two joined cases came on the eve of a Dutch election in which Muslim immigration has been a key issue and is a bellwether for attitudes to migration and refugees across Europe. France votes for a president next month and there too an anti-immigration party is riding high in opinion polls.

The Open Society Justice Initiative, a group backed by the philanthropist George Soros which had supported the women, said it was disappointed by the ruling which it said “weakens the guarantee of equality that is at the heart of the EU’s anti-discrimination directive.”