To survive in hostile environments, cockroaches rely on their own vermin: Blattabacterium, a microbe that hitched a ride inside roaches 140 million years ago, and hasn’t left since.

Researchers who sequenced the Blattabacterium genome have found that it converts waste into molecules necessary for a roach to survive. Every cockroach is a testimony to the power of recycling — thanks to their microbes, they don’t even need to pee.

“Blattabacterium can produce all of the essential amino acids, various vitamins, and other required compounds from a limited palette of metabolic substrates,” write entomologists in a study published Monday in the Proceedings of the National Academy of Sciences.

Researchers have known that cockroaches need the microbes to survive: Kill Blattabacterium with antibiotics, and the insects die. They also knew that roaches store excess nitrogen — one of life’s essential elements, needed to make proteins, amino acids and DNA — inside their bodies, in tiny deposits of uric acid. But researchers didn’t know exactly what became of the uric acid after it was stored, or precisely what Blattabacterium did.

Sequencing the microbe’s genome made the links clear. The microbe contains genes that code for enzymes that break down urea and ammonia, the components of uric acid. Other genes instruct the microbe to take the resulting molecules and use them to make amino acids, repair cell walls and membranes, and perform other metabolic tasks.

This allows cockroaches to subsist on nitrogen-poor diets, an ability “critical to the ecological range and global distribution of the cockroach species,” write the researchers. And what a range it is: There are nearly 5,000 species of cockroaches, spread on every continent, even Antarctica.

Blattabacterium also helps free cockroaches from the need to urinate, said study co-author Srinivas Kambhampati, a Kansas State University entomologist. In humans and other terrestrial animals, otherwise toxic uric acid is diluted with water, then flushed from the body as urine. Cockroaches save that water. Compared to them, the iconic stillsuits worn by the fictional Fremen of Dune would be wasteful.

At this point in cockroach evolution, roaches are utterly dependent on Blattabacterium, said Kambhampati. “They’ve lost the ability to produce their own amino acids, like other animals do. They can’t live without the bacteria,” he said.

That raises the possibility of designing pesticides “that somehow interfere with the function of Blattabacterium, rather than directly killing cockroaches,” Kambhampati said. But he doubted that any such pesticide would work for long before resistance developed, and seemed glum at the prospect of his research being used to exterminate an animal that’s proved so fascinating to study.

“There’s about five or six species associated with humans, and unfortunately they give a bad name to the 4,900 species that live quietly in the forest,” said Kambhampati.