Underwater photographer Tony Wu was snapping photos of sperm whales when, suddenly, one pooped! Its feces spread through the water like a brown cloud. Scientists think that for whales, pooping isn’t just about expelling waste. They may poop to distract predators, like orcas. In this instance, Wu may have frightened the whale, causing it to deploy its disgusting defense.

While it might seem gross, whale poop plays an important role in ocean ecosystems—communities of organisms interacting with their physical environment. Whales expel their poop near the oceans’ surface, where phytoplankton live. These tiny plant-like organisms rely on nutrients in the poop to grow.

Many marine creatures, in turn, eat phytoplankton. That makes phytoplankton the basis for the entire ocean food web—which describes the relationships among species based on what eats what. Whale poop is fertilizer that keeps the food web going, explains Joe Roman, a biologist at the University of Vermont.

To learn about the nutrients in whale feces, Roman seeks out clouds of their poop. From a boat, he uses a net to collect samples. The nutrients in the poop can provide information about the health of the animals and their ocean environment. Whale poop can be unpleasant to work with, depending on the species, says Roman. He explains that humpback whales’ poop smells briny like the sea. But poop from right whales is terribly smelly. If any gets on your clothes, “it doesn’t matter how often you wash them. You’ll have to throw them away,” says Roman.