Confectionery giant Nestle has failed to convince European judges that it has the right to trademark the shape of its four-finger KitKat bar in the UK.
The European Court of Justice said that the company had to demonstrate the public relied on the shape alone to identify the snack.
The judges concluded this was difficult to prove if goods also showed a brand name such as KitKat.
Rival Cadbury has battled to prevent Nestle obtaining the trademark.
Both Nestle and Cadbury said they were "pleased" with the ruling.
The case will now return to the UK High Court for a final decision.
Nestle claimed that in the 80 years since the chocolate bar was introduced, the four fingers have become almost completely associated with KitKats.
In June, a senior European court lawyer, the advocate-general, disagreed saying such a trademark did not comply with European law.
Nestle has not sought to trademark the two-fingered bar.
Sally Britton, intellectual property lawyer at Mishcon de Reya, said that Nestle was likely to continue arguing its case, "even if, as now appears likely, the English court decides that the KitKat shape should not be registered as a trade mark".
She said Nestle had experience of trying to register difficult marks.
It took more than 40 years for it to register the slogan "Have a Break" as a trade mark, finally succeeding in 2006, she added.
Kvikk Lunsj