German chocolate bar maker Ritter Sport on Thursday won a decade-long battle against US-owned Milka, with the European country's highest court ruling that its trademark on the iconic square packaging stands.

Marketed as "square, practical, good", Ritter Sport's chocolates are packed in a plastic folio with two openings along the sides and an opening running down the back, a design that it had patented in 1996 and in 2001.

But Milka, owned by US confectionery giant Mondelez, has challenged Ritter Sport's exclusivity in marketing square chocolate bars.

Although Milka won an initial challenge in 2016, Ritter Sport had been undeterred in its fight.

On Thursday, it took the final round as Germany's Federal Court of Justice found that the patent on the square package could be scrapped only if it provided "an essential value" to the product.

"On the basis of findings by the Federal Patents Court, the square shape of the packaging has no particular artistic value and does not lead to significant price differences with similar products," the court said.

"It may be that the consumer buys the chocolate because the square shape of the packaging gives the consumer an indication that the chocolate originates from a specific company and therefore links that to specific quality. But that is not the point.

"The shape of a product or packaging can only be excluded from trademark protection ... if it gives significant value to the product," added the court.