In the 1960s and '70s, overfishing off the southwestern coast of Namibia (see map) wiped out sardines, allowing two opportunistic jelly species, the many-ribbed jellyfish and the sea nettle, to move in.

The jellies would "hoover up" just about "anything they could get their tentacles on," said study co-author Victoria A. Braithwaite, a fisheries biologist at Penn State University.

And, thanks to their painful stings, the voracious jellyfish are generally not on other animals' menus.

Yet when Braithwaite and colleagues did various experiments on gobies found off Namibia—including an analysis of the fish's stable isotope ratios of carbon, nitrogen, and sulphur—they discovered that the supposedly noxious jellyfish make up a third of the fish's diets.

"Clever" Fish Adapted to Toxic Habitat

Bearded gobies flourish in this harsh habitat because they have built-in—and still mysterious—coping mechanisms, according to the study.

For instance, the gobies are "miraculously" immune to a jellyfish's nasty sting. They've even been seen resting on the organisms's bells, or main body parts, as well as swimming among jellyfish tentacles, Braithwaite said. (See a picture of the deadly box jellyfish.)

Bearded gobies also spend hours in oxygen-deprived "mud mats" on the seafloor, which form when nutrient-rich upwellings from the deep ocean spur a naturally induced plankton bloom.

When the plankton die, their bodies settle to the seafloor along relatively shallow coastal shelves. Bacteria and worms then get to work breaking down the dead plankton, using up most of the oxygen in the mud and releasing poisonous hydrogen sulfide gas.

This "extremely hostile environment" is deadly to most fish—but not to the gobies, the study found. In fact, the fish were almost totally unaffected by breathing hydrogen sulfide.

What's more, the "clever" fish have learned to avoid most predators by dividing their time between the mud mats and the jellyfish-infested waters, she said.

Jellyfish Explosion Not Always Doom and Gloom

It's unknown how goby brains can handle such long periods without oxygen, or why the fish aren't bothered by the toxic mud or stinging jellyfish, Braithwaite said.

But she can say the species is "one of the most uniquely adapted organisms that I've ever come across."