Image caption Lego has lost out to rivals in its battle to trademark bricks

Lego has lost its fight to have its eight-studded bricks protected by trademark law.

The Danish company had appealed to the European Court of Justice to overturn a 2004 decision to cancel Lego's trademark for a red toy building brick.

In a statement the ECJ said that the functional shape of a brick was not registrable as a trademark.

The decision is seen as a victory for Lego rival, Mega Bloks, which makes bricks of the same shape and size.

Technical solutions are capable of protection only for a limited period European Court of Justice

Lego had argued that studs on top of the bricks made them highly distinctive and, thus, eligible for trademark rights.

It had tried to trade mark its red block as it felt that consumers identified it with Lego and were misled when it was used by others.

It was rival Mega Brands, maker of Mega Briks, who challenged Lego's trademark registration.

The Canadian company claimed that Lego was trying to trade mark the appearance of the brick "to confer a potentially everlasting monopoly on a useful product configuration".

"Patents can protect technical solutions, such as the means to interconnect toy bricks, but patent protection is limited in time and Lego's patents for the basic brick have long expired," Megabrands said.

The European Court of Justice found that protecting the shape and function of a product would reduce the opportunities for rival manufacturers to use them.

"Technical solutions are capable of protection only for a limited period," the judgement said, "so that subsequently they may be freely used by all economic operators".

Peter Kjaer, the head of Lego's intellectual property section, said that the company had "no option but to note the court's ruling".

The Danish company will not be able to appeal.