Species of Epichloë (Ascomycota, Clavicipitaceae) are endophytic symbionts of pooid grasses. Sexual reproduction of the fungus depends on gamete-transferring Botanophila flies, which in earlier studies were shown to be specifically attracted by the fungal volatiles chokol K and methyl (Z)-3-methyldodec-2-enoate. As several Epichloë volatiles are known to have antimicrobial properties, it was hypothesised that the original function of insect-attracting volatiles is microbial deterrence. However, the origin of volatile compounds and their toxicity within an ecological context has not yet been clarified. We examined the inhibitory effect of chokol K and methyl (Z)-3-methyldodec-2-enoate on mycoparasites, plant pathogenic fungi and on Epichloë itself at ecologically relevant concentrations, and assessed volatile production in pure cultures of Epichloë on complex and defined media supplemented with inorganic sources of carbon and nitrogen. Chokol K reduced the spore germination of all tested fungi, whereas methyl (Z)-3-methyldodec-2-enoate had no inhibitory effect. Moreover, only chokol K was produced in culture, confirming its fungal origin. Our findings are consistent with the proposed scenario that fungal volatile substances have followed an evolutionary pathway from defence to attraction.