The European Court of Justice has ruled that companies can ban employees from wearing the Islamic headscarf, but only as part of prohibitions including other religious and political symbols.

It is the first case of its kind amid a series of legal disputes over the right for Muslim women to wear the hijab at work.

“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 Luxembourg-based court found that a headscarf ban may also constitute “indirect discrimination” if people adhering to a particular religion or belief, such as Muslims, are put at a particular disadvantage.

But indirect discrimination is permissible if it is “objectively justified by a legitimate aim”, such as a company's policy of neutrality, provided that the means of achieving it are appropriate and necessary.

François Fillon, the conservative candidate in the French presidential election, hailed the ruling as “an immense relief” that would contribute to “social peace”.

But a campaign group backing the women said it could shut many Muslim women out of the workforce and European rabbis said the court had worsened rising hate crime by sending a message that “faith communities are no longer welcome”.

The president of the Conference of European Rabbis, Chief Rabbi Pinchas Goldschmidt, said: “This decision sends a signal to all religious groups in Europe.”

The United Sikhs advocacy group said the “disturbing” ruling allowed employers to override fundamental human rights.

Theresa May backs Muslim women's right to wear a headscarf

Mejindarpal Kaur, the group's international legal director, said that although the ECJ only allowed for rules with “legitimate aims”, “we fear that employers will treat it as a licence to discriminate at the point of hire”.

Amnesty International welcomed the ruling on the French case that “employers are not at liberty to pander to the prejudices of their clients” but said bans on religious symbols opened “a backdoor to precisely such prejudice”.

Two employees in Belgium and France had brought the case to the ECJ after being dismissed for refusing to remove their headscarves, which did not cover the face.

The Belgian woman had been working as a receptionist for G4S Secure Solutions, which has a general ban on wearing visible religious or political symbols, while the French claimant is an IT consultant who was told to remove her headscarf after a client complained.

The G4S dispute, which started in 2006, was originally based on an “unwritten rule” banning employees wearing signs of their political, philosophical or religious beliefs, and the company’s workplace regulations were not updated until a day after the woman started wearing a hijab.

Although they apply to all beliefs, the ECJ said it was “not inconceivable” that such rules could be deemed indirect discrimination for targeting Islam over other religions and referred the issue back to the Belgian Court of Cassation.

The French claimant, a design engineer for Micropole, was asked to stop wearing her headscarf to maintain neutrality after a client’s complaint but refused and was dismissed.

Hijabs are headscarves that cover the hair, leaving the face open (AFP/Getty)

The ECJ referred the case back to the French Court of Cassation to establish whether the move was a “genuine and determining occupational requirement” and whether there were any formal rules in place that meet non-discrimination requirements.

The court's advocate general recommended that companies should be allowed to prohibit headscarves as long as a general ban on other symbols was in place, theoretically applying to Sikh turbans, Jewish kippas and Christian crucifixes.

Their advice in the French case was that a rule banning employees from wearing religious symbols when in contact with customers was discrimination, particularly when it only applied to Islamic headscarves.

Jonathan Chamberlain, an employment lawyer at Gowling WLG, said the decision brings the EU into line with what has been the UK's approach for several years.

“For example, it's fine for employers to have a dress code but it needs to be applied with some sensitivity and flexibility to take account of religious beliefs,” he added.

“What is almost certainly never OK is for an employer to tell an employee to stop wearing a religious symbol because a particular customer has asked for it."

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.

A spokesperson said it ”weakens the guarantee of equality that is at the heart of the EU’s anti-discrimination directive”.

In pictures: Protest against burkini bans in London Show all 10 1 /10 In pictures: Protest against burkini bans in London In pictures: Protest against burkini bans in London Demonstrators stage a beach party outside the French Embassy, in Knightsbridge, London, in protest against burkini bans PA In pictures: Protest against burkini bans in London Jenny Dawkins, a curate from All Saints Church in Peckham, at an anti-burkini ban protest at the French Embassy in London on 25 August Lizzie Dearden In pictures: Protest against burkini bans in London Demonstrators stage a beach party outside the French Embassy, in Knightsbridge, London, in protest against burkini bans PA In pictures: Protest against burkini bans in London Somayia Khan's six-year-old daughter at a protest against burkini bans at the French Embassy in London on 25 August Lizzie Dearden In pictures: Protest against burkini bans in London Friends Rebecca (L) and Hannah (R) at a protest against burkini bans at the French Embassy in London on 25 August Lizzie Dearden In pictures: Protest against burkini bans in London Demonstrators stage a beach party outside the French Embassy, in Knightsbridge, London, in protest against burkini bans Reuters In pictures: Protest against burkini bans in London Demonstrators stage a beach party outside the French Embassy, in Knightsbridge, London, in protest against burkini bans EPA In pictures: Protest against burkini bans in London Demonstrators stage a beach party outside the French Embassy, in Knightsbridge, London, in protest against burkini bans AFP/Getty Images In pictures: Protest against burkini bans in London People participate in a 'Wear what you want beach party' protest outside of the French Embassy in London EPA In pictures: Protest against burkini bans in London A protester holds a sign which reads "Are you Burkini Beach Body Ready?" as she lies on a beach towel outside the French Embassy in London on August 25, 2016, AFP/Getty Images

Maryam Hmadoun, the initiative’s policy officer, said: “In many member states, national laws will still recognise that banning religious headscarves at work is discrimination.

“But in places where national law is weak, this ruling will exclude many Muslim women from the workplace.”

The Open Society Justice Initiative said all future cases on religious discrimination in workplaces inside the EU will be government by the ruling, which it feared would strengthen wider attempts at headscarf bans.

“When an employer singles out religious clothing this is direct discrimination, and such an aim is not neutral,” a statement said.

“The supposed ‘neutrality’ is really discrimination, making the false claim that employers who allow staff to wear the headscarf are in some way not neutral.”

The ruling, which sets an EU-wide precedent, came a day before the Netherlands’ parliamentary elections, which have been dominated by issues of integration and identity.

Dutch MPs voted in support of a partial ban on full-face Islamic veils last year, but no law has yet been implemented, while prohibitions have been implemented in countries including France, Belgium and Bulgaria, and are being considered in Germany.