show Abstracthide AbstractThe black soldier fly (Hermetia illucens) is a prime candidate for the developing global industry of insects as food and feed, but the genetic basis of its domestication has not been studied. We obtained whole genome sequences from both wild and captive populations representing 54 individuals. We identified two genetic lineages at least 3 million years diverged revealing a cryptic species complex. Genetic evidence also suggests unsampled taxa appear to have contributed to an extremely divergent lineage approximately 6.8 million years ago. Our study indicates that the most common populations used for commercial and academic application are primarily derived from just one of these extremely diverged lineages, originating from a wild North American progenitor. Despite insect farming practices only reaching mass production scale over the past two decades, we find captive populations showing strong genome-wide signatures of domestication. We identify multiple selective sweeps associated with domestication containing development, behaviour, reproduction, metabolism and immunity genes. Identified sweeps reoccur exclusively in domestication populations suggesting five common domestication loci located on chromosomes two, four and five. Populations in the early stages of domestication also show evidence of convergent genome evolution with signatures of domestication over these same regions. Gene flow between divergent lineages was observed, but minimal, and evidence of hybridisation from domesticated populations into the wild was recorded. This population genetic approach reveals the genetic basis of domestication in H. illucens highlighting the importance of introducing genetic surveillance and potential for breeding programs in this novel agricultural sector.