Hallucigenia lived 505 million years ago. M. R. Smith / Smithsonian Institute

A spiky worm-like creature dubbed one of the most bizarre-looking fossils ever found has finally found its place in the Tree of Life.

Hallucigenia, named so for its alien appearance, was considered to be an "evolutionary misfit" because it was not clear how it fitted in to evolution or how it related to modern animals.

The worm-like creature had legs, spikes and a head that was difficult to distinguish from its tail.

The spines along its back were at first thought to be legs, while its legs were thought to be tentacles. Its head was also mistaken for its tail.

Hallucigenia was first identified in the 1970s. It lived in the Cambrian Explosion, about 505 million years ago – a period of rapid evolution when most major animal groups first appeared.

It measured between five and 35mm long and lived on the floor of the Cambrian oceans.

Published in the journal Nature, researchers from the University of Cambridge have now discovered an important link between Hallucigenia and modern velvet worms.

Their claws – located at the end of their eight sets of legs –have layers of nail stacked inside one another. The same structure can be seen in the jaws of velvet worms.

Lead author Martin Smith said: "It's often thought that modern animal groups arose fully formed during the Cambrian Explosion. But evolution is a gradual process: today's complex anatomies emerged step by step, one feature at a time. By deciphering 'in-between' fossils like Hallucigenia, we can determine how different animal groups built up their modern body plans.

"The peculiar claws of Hallucigenia are a smoking gun that solve a long and heated debate in evolutionary biology, and may even help to decipher other problematic Cambrian critters."