The defensive and bioactive polyacetylenic fatty acid, 8Z-dihydromatricaria acid, is sequestered within a wide range of organisms, including plants, fungi and soldier beetles. The 8Z-dihydromatricaria acid is concentrated in the defence and accessory glands of soldier beetles to repel avian predators and protect eggs. In eukaryotes, acetylenic modifications of fatty acids are catalysed by acetylenases, which are desaturase-like enzymes that act on existing double bonds. Here we obtained acyl Coenzyme A-linked desaturases from soldier beetle RnA and functionally expressed them in yeast. We show that three genes were sufficient for the conversion of a common monounsaturated fatty acid, oleic acid, to the 18 carbon precursor of 8Z-dihydromatricaria acid, that is, 9Z,16Z-octadecadiene-12,14-diynoic acid. These are the first eukaryotic genes reported to produce conjugated polyacetylenic fatty acids. Phylogenetic analysis shows that the genes responsible for 8Z-dihydromatricaria acid synthesis in soldier beetles evolved de novo and independently of the acetylenases of plants and fungi.