Scientists have discovered a new species of hermit crab off the coast of Japan that roams the ocean floor with coral on its back.

While most people think of coral as belonging to permanent reefs such as the Great Barrier Reef in the waters off Australia, there is a type called "walking" coral.

This free-living coral (meaning it's unattached) is sometimes inhabited by marine worms that seek protection from predators. They, in turn, help the coral get around and not be buried under sediment.

Hermit crabs, meanwhile, are known to scavenge seashells and use them as shells to protect themelves. But it turns out that one particular hermit crab has decided to take the place of the worm and use the coral for itself.

The newly discovered crab species, Diogenes heteropsammicola, was identified purely by accident.

Momoko Igawa, co-author of the paper published in PLOS One, told CBC News that Mokoto Kato (who is also a co-author), had collected a walking coral from a survey in Oshima Strait north of Kakeorma Island in the south of Japan in 2012.

I was amazed at the mysterious animal. - Momoko Igawa, co-author

"The coral had been fixed in 99 per cent ethanol, but we cracked the coral and observed internal corallum structure," Momoko said in an email.

"As a result, we found that a very slender hermit crab was in the coral. Since then, we have been collecting walking corals in Oshima Strait every year in order to see the hermit crab alive."

The hermit crab itself is red and white with unusually slender legs and claws. And while most hermit crabs have an asymmetrical tail segment which fits nicely with the usually right-handed coiled shells they call their homes, this new one has a symmetrical tail. The researchers theorize that it may help it adapt to corals which could have coils that go in either direction.

And there's no getting this crab out of its new home: when the researchers turned the coral upside down, the crab leaned out with its long legs and turned the coral upright. And if buried, the crab dug itself out, never leaving the coral.

As well, the coral actually grows alongside the crab, which allows the hermit crab to permanently settle in the coral; there's no need for it to find somewhere larger to settle down as it grows.

Igawa said that he's particularly interested in discovering the evolutionary history of this unique species and how the pair live together.

"I was amazed at this mysterious animal," he said.