Meet the bootlace worm, Lineus longissimus. It's ugly. It stinks. It produces an offensive mucus. And, if a specimen that washed up on Scotland's shores in the 19th century is anything to go by, they rank among the longest animals on the planet.

What that 55 metres (180 feet) of living horror noodle lacks in charm it might make up for in usefulness in pest control, with a toxin found in its slime that is non-toxic to humans but proves deadly to various arthropods. And that includes cockroaches.

Let's face it, some insects we just love to hate. Cockroaches are the perfect example – those smug little faces and a reputation for surviving anything nature throws at them makes you want to empty a can of bug-spray on their backs.

This newly discovered protein could be the ultimate answer in not just anti-roach weaponry, but in other damaging creepy-crawlies such as varroa mites and even fruit flies.

A team of international researchers turned their attention to a group of marine worms known as nemerteans thanks to their remarkable similarity to another toxic organism.

"Nemerteans have striking similarities with cone snails," the researchers write in their report.

"Both phyla use a proboscis for capture of prey, and one sub-class of nemerteans is also equipped with a stylet having the same apparent function as the radula tooth of the cone snail: venom injection."

But rather than look at what they might be injecting, the team investigated a more conspicuous place for a deadly chemical soup – their covering of mucous.

The nemerteans' slime has been known to have a toxic effect on humans for centuries. In the mid-16th century, the Swedish naturalist Olaus Magnus described how brushing against an enormous specimen could lead to swelling.

But until now, much of the chemical make-up of this material has never been scrutinised in great detail.

Some of the mucous' smaller, low-weight organic compounds such as tetrodotoxins and alkaloids have been identified in previous studies.

In this study, it was protein-based neurotoxins they were hoping to get a handle on.

Their analysis revealed a completely new family of toxic peptide based on a kind of bridging structure called a cystine knot, which they dubbed alpha-nemertides.

By mapping the way the genomes of 17 species of nemertean produced proteins, the team discovered eight examples of this compound.

Its effects became clear when the researchers tested one of the compounds on several species of invertebrate. One was the green crab, Carcinus maenas. Another test included juvenile specimens of Blaptica dubia – the humble orange-spotted cockroach.

At relatively low concentrations all of the test specimens were either dead or paralysed.

Further research that included varroa mites and drosophila fruit flies showed the proteins targeted sodium channels in the invertebrates' nervous systems, preventing them from closing and locking the nerves into permanent action.

Since the same tiny concentrations of the compound on mammal nerves was significantly less potent, alpha-nemertides just might make for a decent insecticide that could blast bugs but have no effect on us or our pets.

Current searches for the next generation of pesticides have been focussing on more widely known venomous creatures, such as snakes and spiders.

This new kind of worm toxin has the advantage of being powerful at a fraction of the concentration.

Clearly more work needs to be done before we can expect to whip out a can of alpha-nemertide roach spray from under the sink.

But if the Apocalypse doesn't give the cockroaches nightmares, a 55 metre long, slime coated marine worm should.

This research was published in Scientific Reports.