By peering into the genes of the mimic octopus, which has the mind-boggling ability to shift its color and shape to impersonate anything from sea snakes to stingrays, scientists are now uncovering the evolutionary steps it took to become a master of disguise.

The eight-legged "oracle" known as Paul the Octopus recently made international headlines with its amazingly lucky forecasts during the World Cup. But the most jaw-dropping octopus might actually be the Indonesian mimic octopus (Thaumoctopus mimicus).

This shape-shifter can alter its colors, contort its body and undulate to imitate the appearance of giant crabs, seashells, flatfish, brittle stars and other critters. For instance, to mimic a lionfish, it adopts striped patterns on its skin and juts its arms out like the fish's many venomous spines; to mimic a deadly sea snake, it hides its body in a hole, leaving only two arms out, which it moves together to impersonate the serpent. [Video – Watch the Mimic Octopus in Action.]

"The intelligence that is implied by their ability to mimic different kinds of sea animals depending on the circumstances is astonishing," researcher Healy Hamilton, evolutionary biologist and director of the Center of Applied Biodiversity Informatics at the California Academy of Sciences, told LiveScience.

How to make a master of disguise

Like its relatives, the mimic octopus can hide from hungry predators by blending into its background. So scientists have wondered why the multitalented species instead often chooses to mimic dangerous creatures with eye-catching color patterns, a daredevil maneuver thought to help it confuse or scare away threats.

"The close relatives of T. mimicus use drab colors and camouflage quite successfully to hide from predators," said researcher Christine Huffard, marine conservation priorities advisor and behavioral ecologist at Conservation International Indonesia. "Why does T. mimicus instead draw attention to itself, and repeatedly abandon the camouflage abilities it inherited from its ancestors in favor of a bold new pattern?"

To find out more about how this master of disguise developed its abilities over time, the researchers analyzed DNA sequences of the mimic octopus and more than 35 of its relatives.

"DNA sequencing is a very powerful tool to really identify who is most closely related to who in animals whose morphology is highly variable like octopuses," Hamilton said.

The researchers next compared physical and behavioral traits among the relatives, some of which are also capable of mimicking flatfish, such as the Atlantic longarm octopus (Macrotritopus defilippi). By seeing which traits many of the octopuses possessed, they could determine which traits evolved first, and by analyzing which traits only close relatives of the mimic octopus shared, they could tell which developed later.

Results showed the ancestors of T. mimicus first evolved the use of striking displays of dark and light bands, employed to surprise predators if camouflage failed, potentially buying them time to escape. Next, they figured out how to flatten their arms and head and swim like a flatfish, and also developed the long arms that facilitate this motion. Finally, the mimic octopus began displaying bold color patterns while impersonating a flatfish — both at rest and during daily forays away from its den.

"Somehow, through natural selection, being conspicuous has allowed T. mimicus to survive and reproduce more successfully than some of its less showy ancestors, and eventually evolve into its own lineage," Huffard said.

Risky evolutionary step

In evolutionary terms, the last step the mimic octopus took represented an extremely risky shift in defense strategy. The researchers suggest this trick could fool predators into thinking the octopus is a toxic flatfish such as the peacock sole or the zebra sole. It may also obscure the octopus's outline against the black-and-white sandy bottoms, or serve as an honest warning sign of the mimic's unpalatable flesh.

"While T. mimicus's imitation of flatfish is far from perfect, it may be 'good enough' to fool predators where it lives, in the world's center of marine biodiversity," Hamilton said. "These octopuses can change their color pattern to look similar to — but not exactly like — numerous toxic and non-toxic flatfishes in their area.”

First described by scientists in 1998, much remains unknown about the mimic octopus. Future research will focus on observing it in the wild in Indonesia, so that scientists can assess the possible reasons for its actions and better understand the costs and benefits of the strategy.

"This study reminds us that evolution does not have an endgame, but is a continuous process," Huffard added. "These octopuses will continue evolving as long as we can protect them and their habitat from threats like trawling, land reclamation and run-off."

The scientists detailed their findings in the September issue of the Biological Journal of the Linnean Society.