Near New Caledonia, a French archipelago in the southern Pacific Ocean, turtle-headed sea snakes swim around, gobbling up fish eggs from the bottoms of bays and lagoons. On these islands, tourists sunbathe on beaches, cars drive on roads and workers mine nickel in the mountains. When it rains, pipes and rivers carry runoff from these activities and dump it directly into the homes of sea snakes.

Dr. Shine observed that most of the sea snakes there were black — as they were in a remote atoll nearby that was used as a bombing range. This was weird, he thought, because in the rest of their range, from northern Australia to Vietnam, about 95 percent of the sea snakes wrapped themselves in skins of blue and black bands or speckles.

There seemed to be no advantage.

But then Claire Goiran, a marine biologist at Labex Corail & Université de la Nouvelle-Calédonie in New Caledonia and lead author of the study, told Dr. Shine about black pigeons that dominated the streets of Paris. She had learned that in their black feathers, they collected metals from the city and shed them when they molted. Maybe the sea snakes did something similar.

To find out, the researchers tested the shed skins of black and banded sea snakes for more than a dozen trace minerals, including zinc, arsenic, cobalt and nickel. As expected, the black skin — whether it belonged to a whole black snake or just a black band — contained more of the metals.

Trying to figure out the evolutionary advantage of this correlation, the researchers determined that it wasn’t camouflage. And it didn’t make snakes sexier to other snakes. They reasoned that the minerals accumulated in the water, moved up the food chain and became sequestered in the black skin. The dark skin also attracted an algae, which took residence on the snakes’ bodies, creating a heavy, velvety cloak. To get rid of the algae, which slowed them down in the water, the snakes shed their skin more often, protecting them from levels of metals that are toxic in other animals. Like the urban moths and pigeons, their skin may have adapted to deal with a stressful environment.