In the other case, Asma Bougnaoui, a Muslim woman, arrived at Micropole - a consulting, engineering, and training firm - in France for an internship in February 2008 wearing a bandana but later wore a headscarf.
The ruling centers on women wearing the Islamic headscarf to work, which employers can disallow if they have a policy of "neutral" dress, according to today's ruling. In the second case, another Muslim woman - Asma Bougnaoui - was sacked from a tech consultancy firm after a customer said his employees were "embarrassed" by the hijab she wore while giving them a presentation.
In the similar French case Bougnaoui and another v Micropole Univers, a Muslim IT engineer who wore an Islamic headscarf was told by her employer to remove it while visiting clients, after a client's staff complained. In this instance, the court ruled that she had been discriminated against as the company had no "image neutrality" policy and only dismissed her following the client's complaint.
Achbita has lost her discrimination lawsuit in two Belgian courts and is now before the country's Court of Cassation, which sought the European Union court's opinion.
The ruling comes amid tensions across Europe about the migrant crisis and just before the Dutch election, in which Muslim immigration has featured prominently.
France already bans headscarves and other religious symbols in classrooms. Prohibiting wearing a headscarf, under such circumstances where the rule was applied in a "consistent and systematic manner" did not "constitute direct discrimination based on religion or belief", it concluded.More news: Florida man accused of setting fire targeting Muslims
More news: Intel buys driverless vehicle company Mobileye for $15bn in record-breaking deal
More news: Will the Atomic Storage by IBM Create Nano-Storage Devices in Future?
"Such a ban may be justified if it enables the employer to pursue the legitimate policy of ensuring religious and ideological neutrality", she added.
Meanwhile intense Muslim unhappiness over the ruling was articulated by the Islamic Human Rights Commission, a London-based lobby group, where a spokeswoman said: "This gives legal cover to what is essentially an ongoing hate campaign to make Muslims second-class citizens in Europe".
Judges said that "wishes of a customer no longer to have the services" of a company where employees wear an Islamic headscarf could not be considered "genuine and determining occupational requirement".
This was the ECJ's first decision on the issue, and was delivered on two separate cases. At the time, an unwritten internal rule banned employees from wearing visible signs of their political, philosophical and religious beliefs.
"An internal rule of an undertaking which prohibits the visible wearing of any political, philosophical or religious sign does not constitute direct discrimination", the Luxembourg-based court said.
Amnesty International said the rulings were "disappointing".