Capsaicin keeps fungus from chomping on pepper plants but does nothing to dissuade hungry bugs.

The ingredient that provides the sting in pepper sprays used for self-defense is capsaicin, the same chemical that lends jalapeños, habaneros, and other chili peppers their heat. But some chilies are a lot hotter than others, and some are mild. What makes certain ones so intense? A new study suggests that hot peppers crank up the capsaicin content for self-defense too.

Joshua Tewksbury, a biologist at the University of Washington in Seattle, analyzed the distribution of different varieties of chili pepper in Bolivia, where chilies are believed to have first evolved. He found that areas with the greatest number of fruit-eating insects had hotter chili peppers than other areas. He also found that although capsaicin did not bother insects nibbling on the peppers’ flesh, it did inhibit a fungus that feeds on the seeds of chili peppers that have been scarred by insects. “In populations where there are a lot of insects,” Tewksbury explains, “the fruit get attacked by more fungus, and the plants with capsaicinoids are better protected from it.” Thus, the capsaicin serves as a chemical weapon that helps the seeds survive intact for dispersal by fruit-eating birds, which are insensitive to capsaicin.

Other microbes are also thwarted by superhot fruits, a fact that humans may have exploited by mixing hot chilies into their diet and using them to preserve foods before there was refrigeration. “Human use of chilies,” Tewksbury says, “may mirror the evolutionary function of these compounds in the fruits that produce them.”