Employers are entitled to ban staff from wearing visible religious symbols, the European Union's top law court ruled on Tuesday, a decision Muslims said was a direct attack on women wearing hijabs at work.

The European Court of Justice (ECJ) said it does not constitute "direct discrimination" if a firm has an internal rule banning the wearing of "any political, philosophical or religious sign".

The court gave a judgment in the cases of two women, in France and Belgium, who were dismissed for refusing to remove hijabs, or the headscarf worn by many Muslim women who feel it is part of their religion.

READ MORE: What the hijab means to me

Critics called the ban a thinly veiled measure targeting Muslims.

"A ban on religious and political symbols feels to me as a disguised ban on the hijab. I cannot think of another symbol that will affect hundreds of thousands of people in Europe ," Warda el-Kaddouri told Al Jazeera from Brussels.

"By stating that veiled women can simply take off their hijab, you imply that the empowerment of women to be in control of their own body and to make individual decisions is reserved for white women only."

Kim Lecoyer, president of Belgium-based Muslim Women Lawyers for Human Rights, told Al Jazeera the ruling legitimised discrimination on the grounds of religion.

"The court could and should have seized the opportunity to put a halt to the multiple discriminations faced by Muslim women and protect their fundamental rights, but they chose not to," said Lecoyer.

Anti-Muslim nationalism

The wearing of religious symbols, especially the hijab, has become a hot button issue with the rise of nationalist and sometimes overtly anti-Muslim parties across Europe.

Some countries such as Austria are mulling a complete ban on the full-face veil in public, while in France last year local authorities barred women wearing the burkini, the full-body swimsuit, fining those who did.

Manfred Weber, head of the centre-right European People's Party, the biggest in the European Parliament, welcomed the ECJ's ruling as a victory for European values.

"Important ruling by the European Court of Justice: employers have the right to ban the Islamic veil at work. European values must apply in public life," Weber said in a tweet.

Al Jazeera's Natacha Butler, reporting from Paris, said Tuesday's ruling is complex.

"The idea behind it is that companies have the freedom to choose whether or not they want to present a so-called neutral image and what they want to do to benefit their business."

Butler said the court ruled businesses should have the freedom to choose how they operate, and that included choosing whether people would be allowed to wear items such as hijabs or crosses on chains.

"It's going to be very complicated to rule on such cases within each country, because it will come under the jurisdiction of each separate nation in the EU, because there are so many shades of grey what constitutes discrimination against somebody’s religious freedom or not," she said.

The ECJ ruled on a case dating to 2003 when Samira Achbita, a Muslim, was employed as a receptionist by G4S security services in Belgium .

At the time, the company had an "unwritten rule" that employees should not wear any political, religious or philosophical symbols at work, the ECJ said.

In 2006, Achbita told G4S she wanted to wear a hijab but was told this would not be allowed. The company subsequently introduced a formal ban. Achbita was dismissed and she went to court claiming discrimination.

READ MORE: Sweden's 'hijabista' - selling Muslim fashion

The ECJ said European Union law does bar discrimination on religious grounds, but G4S's actions were based on treating all employees the same, meaning no one person was singled out for application of the ban.

"Accordingly, such an internal rule does not introduce a difference of treatment that is directly based on religion or belief," it said.

However, in a related case in France, the ECJ ruled a customer could not demand that a company employee not wear a hijab when conducting business with them on its behalf.

Design engineer Asma Bougnaoui was employed full-time by Micropole, a private company, in 2008, having been told that wearing the hijab might cause problems with clients.

After a customer complaint, Micropole asked Bougnaoui not to wear the hijab on the grounds that employees should be dressed neutrally.

WATCH: Why do some women choose to wear a veil?

She was subsequently dismissed and went to court claiming discrimination.

The ECJ said the case turned on whether there was an internal company rule in place applicable to all, as in the G4S instance, or whether the client's demand meant Bougnaoui was treated differently.

The ECJ concluded that Bougnaoui had indeed been treated differently and so the client's demand that she not wear a hijab "cannot be considered a genuine and determining occupational requirement".

The ruling comes on the eve of a Dutch election in which Muslim immigration has been a key issue and a bellwether for attitudes towards migration and refugee policies across Europe.

Nihad el-Aabedy contributed to this report