Clever and strange, octopuses are fascinating creatures with incredible problem-solving skills and breathtaking camouflage. But overall, they are short-lived, typically around for just one to two years.

That's because they're semelparous, which means they reproduce just once before they die. With female octopuses, once she's laid her eggs, that's it.

In fact, the mother even stops feeding - she'll stay and watch over her eggs until they hatch, slowly starving to death. In captivity, towards the end, sometimes she'll tear off her own skin, and eat the tips of her own tentacles.

Now, scientists have figured figured out why this grim scenario happens. It has to do with the optic gland between the octopus's eyes; a gland similar to the pituitary gland in humans.

In 1977, researchers removed this gland and found that the octopus' mothering instincts disappeared. She abandoned her eggs, started feeding again, and went on to live a much longer life.

The maturation of the reproductive organs appears to be driven by secretions from the optic gland. These same secretions, it seems, inactivate the digestive and salivary glands, which leads to the octopus starving to death.

In new research, neurobiologists from the University of Chicago used genetic sequencing tools to describe the precise molecular signals produced by the optic gland of a female California two-spot octopus (Octopus bimaculoides) after reproducing.

They also described four distinct phases of maternal behaviour that they were able to link to these signals, explaining how the optic gland drives her death.

"We're bringing cephalopod research into the 21st century, and what better way to do that than have this unveiling of an organ that has historically fascinated cephalopod biologists for a long, long time," said neurobiologist Z. Yan Wang.

"These behaviours are so distinct and so stereotyped when you actually see them. It's really exciting because it's the first time we can pinpoint any molecular mechanism to such dramatic behaviours, which to me is the entire purpose of studying neuroscience."

The first phase is a mature, non-mated female, who is active and an agile and aggressive hunter, spending a lot of time out of her dens.

In the second phase, just after brooding, she will watch over her eggs, stroking them and blowing water over the clutch. She won't actively go out and hunt, but she may snare the occasional unlucky crab that ventures too close. This lasts around 3 to 4 days.

In the third phase, she stops eating entirely, growing more listless. This lasts 8 to 10 days.

Finally, in the fourth phase, she grows agitated. The researchers observed the octopuses slamming themselves against their tanks, grooming themselves ragged, tangling their tentacles and growing pale and emaciated, before dying shortly after the eggs had hatched.

The researchers collected the optic glands from octopuses in each of these four stages, and sequenced the RNA to find out exactly what was occurring.

Before mating, the octopuses produced high levels of neuropeptides, small protein-like molecules that have been linked to feeding behaviour in many animals. After mating, neuropeptide production plummeted.

After mating, the octopuses showed an uptick in the production of catecholamines, steroids that regulate cholesterol metabolism and insulin-like factors - the first time the optic gland has been linked to a function that doesn't have something to do with reproduction.

The finding suggests that the optic gland doesn't produce just a single hormone to regulate reproduction, but uses multiple signalling pathways, possibly to keep the mother octopus watching over her precious eggs.

How these pathways occur is still a puzzle to be unravelled - whether the neurotransmitters that kick in after mating target reproductive tissues that promote maternal instincts, or shut down the digestive functions to keep her closer to her eggs is unknown.

"Before when we only knew about the optic gland, it felt like watching the trailer to a movie," Wang said. "You get the gist of what's going on, but now we're beginning to learn about the main characters, what their roles are and a little bit more about the backstory."

What's also is unknown is why male octopuses tend to die shortly after mating as well, even though they don't have the same parental obligation to care for the eggs. So, there are still plenty of mysteries to be unravelled when it comes to our tentacled friends.

The team has published their paper in the Journal of Experimental Biology.