The question arose – the way questions can in science – when the team was faced with a freshly dismembered octopus arm that eagerly clung to everything it touched, with the notable exception of itself.

Octopuses are among the most extraordinary creatures in the ocean. They can blend into the background, morph into the shape of other beasts, and even regrow limbs lopped off by predators and scientists.

But for all their impressive feats, the octopus's walnut-sized brain cannot keep track of what its eight arms are doing. The problem is too hard. Since each arm is studded with suckers that act on contact, the mystery is this: how do octopuses not get tangled up in knots?

Researchers in Israel set out to answer the question in a series of experiments that grew steadily more gruesome and in time made full use of the common octopus's ability to grow back missing appendages.

Binyamin Hochner and his colleagues at the Hebrew University of Jerusalem had studied octopus arms for years. The limbs are intriguing for roboticists, because they are autonomous: none of the arms knows what the others are doing. Instead of being controlled from a central brain, decisions over much of their movement and behaviour are made within the arms themselves. Of the octopus's 500 million nerve cells, more than half are in their arms.

But octopus arms have more than a mind of their own. They can survive for around an hour after being amputated. Lone limbs have been seen to grab food and even pass morsels to where the arm thinks its owner's mouth must be.

It was a student of Hochner's who noticed, while working on other aspects of the octopus arm, that its suckers attached to everything except octopus skin. Something about the skin turned the suckers off. "We discovered this by accident. We're amazed nobody noticed it before," Hochner told the Guardian.

And so began the trials. On more than 30 occasions, Hochner noticed that amputated octopus arms never latched on to themselves or the arms of other octopuses. They would attach to petri dishes, but if half the petri dish was covered in gel soaked in octopus skin extract, the suckers avoided that half. The only time one amputated arm grabbed hold of another was when the latter had been peeled.

Tests on octopuses that had intact limbs were more equivocal. Presented with dismembered arms, some octopuses grabbed them as if they were lumps of food, and brought them to their mouths. They were less likely to do so if the amputated arm was one of their own.

Unsurprisingly, some octopuses seemed a little stumped. One octopus repeatedly rubbed its arms over an amputated appendage, touching it, but never activating its suckers. Others grabbed at amputated arms, but only where the flesh had been exposed where the limb was severed. Still more brought severed limbs to their mouths and held them with their beaks while the arms quickly let go. "The octopus cannot hold the arm properly with its suckers, so the only way it can hold it is with its beak," said Hochner. The scientists named the behaviour "spaghetti holding".

The experiments, described in the latest issue of the journal Current Biology, suggest that octopuses have a chemical in their skin that stops their suckers from sticking. But the mechanism is akin to a default setting, which the octopuses' brain can apparently override.

"It's a brilliant solution to what could be a really complex problem," Hochner said.

The scientists now want to learn which chemical, or combination of chemicals, is responsible for blocking the octopus's suckers, and how the animals can tell their own flesh from that of others.