A new study has found that emerald cockroach wasp larvae secrete an antimicrobial liquid to prevent their food from spoiling.

Emerald cockroach wasps are known to sting a cockroach twice - once in its midsection and the second time in the roach's brain - in order to prevent the insect from escaping and tame it. The wasps then lay their eggs in the cockroach's legs which then hatch into larvae that feed on its host.

Cockroaches are dirty insects that are covered in bacteria. The microbes spoil the roach's flesh and, in turn, threaten the larval wasps that live inside the cockroach during their long incubation period.

Now, a team of German researchers has found that the larval wasps have a special ability to survive on their own. For the study, the research team cut the side of a parasitized cockroach and installed a small window. This allowed them to see what the wasp does inside the cockroach's body, according to a report in phys.org.

They noticed that the larva wasp spits a liquid solution from its mouth and uses the fluid to cover the inside parts of the body before it begins consuming the cockroach.

When experts analyzed the liquid, they found that it contained micromolide and mellein - chemicals that work as antibacterial agents. These chemicals prevent the growth of microbes like bacteria and virus.

To test the effectiveness of the liquid solution, the research team used the chemicals in a bacteria culture. They found that the fluid killed different types of bacteria.

"On the one hand, the finding is surprising, because such a simple, little insect larva uses such a sophisticated strategy to ward off detrimental bacteria," co-author of the study Gudrun Herzner, a researcher at Germany's University of Regensburg, told LiveScience. "The larvae are like little chemical plants that produce large amounts of different antimicrobial substances."

The findings of the study appear in the Proceedings of the National Academy of Sciences.