Through a careful analysis of fossilised seafloor layers dating back some 20 million years, scientists have reconstructed the lair of a giant underwater worm that would most probably have lain hidden in sediment before leaping up to ambush its prey.

The newly identified creature is likely to be an ancestor of the Eunice aphroditois or bobbit worm that exists today, say the researchers – these scary-looking modern day creatures can grow up to 3 metres (about 10 feet) in length, grabbing and trapping their food with powerful jaws and sharp mouthparts.

While the history of worms like these is already thought to stretch back hundreds of millions of years - perhaps into the early Palaeozoic - their soft body parts mean there's a largely incomplete fossil record for them, which makes this new find significant.

The team behind the new study recovered and processed 319 specimens to reconstruct a trace fossil (the trace of an animal, rather than the animal itself), an L-shaped burrow around 2-3 centimetres (0.8-1.2 inches) in diameter and up to 2 metres (about 6 and a half feet) in length.

The trace fossil, what is also known as an ichnospecies, has been named Pennichnus formosae; based on an analysis of the burrow's size and shape, as well as the signs of the disturbance left in the rock record, it looks as though it was home to an ancient worm that also jumped up from the seabed to capture prey.

"These morphological features of Pennichnus are consistent with the activities of an ambush predator, and hence, we hypothesise that giant polychaetes, such as bobbit worms, are the most probable trace makers," write the researchers in their paper.

One of those morphological features is the high concentration of iron up towards the top of the burrow. This suggests that the ancient worms used mucus to rebuild their lairs after attacking, as bacteria feeding on this mucus would have left traces of iron.

Other potential inhabitants of P. formosae, including shrimp and molluscs, were ruled out: shrimp tend to make more open and more complex burrows, while the burrow shape and structure doesn't match the patterns left by molluscs.

The findings plug a gap in our knowledge of how this type of creature evolved and developed over time – and just how dramatic life (and death) down at the bottom of the oceans has been for millions of years.

"To summarise, we hypothesise that about 20 million years ago, at the southeastern border of the Eurasian continent, ancient bobbit worms colonised the seafloor waiting in ambush for a passing meal," write the researchers.

"When prey came close to a worm, it exploded out from its burrow, grabbing and dragging the prey down into the sediment. Beneath the seafloor, the desperate prey foundered to escape, leading to further disturbance of the sediment around the burrow opening."

The research has been published in Scientific Reports.