Background Open cast lignite mines, sand pits and military training areas represent human-made, secondary habitats for specialized xerothermophilous and psammophilous species. Rare species, including the earwig Labidura riparia, are found in high population densities in such sites. However, it is unknown from which sources colonisation took place and how genetic variation compares to that of ancient populations on natural sites. Methods Using nine microsatellite markers, we analysed genetic variation and population structure of L. riparia in 21 populations in NE Germany both from secondary habitats such as lignite-mining sites, military training areas and a potassium mining heap, and rare primary habitats, such as coastal and inland dunes. Results Genetic variation was higher in populations from post-mining sites and former military training areas than in populations from coastal or inland dune sites. Overall population differentiation was substantial (FST = 0.08; F'st = 0.253), with stronger differentiation among primary (FST = 0.196; F'st = 0.473) than among secondary habitats (FST = 0.043; F'st = 0.147). Differentiation followed a pattern of isolation by distance. Bayesian structure analysis revealed three gene pools representing primary habitats on a coastal dune and two different inland dunes. All populations from secondary habitats were mixtures of the two inland dune gene pools, suggesting multiple colonization of post-mining areas from different source populations and hybridisation among source populations.Discussion Populations of Labidura riparia from primary habitats deserve special conservation, because they harbour differentiated gene pools. The majority of the Labidura riparia populations, however, thrive in secondary habitats, highlighting their role for conservation.Implications for insect conservation A dual strategy should be followed of conserving both remaining natural habitat harbouring particular intraspecific gene pools and secondary habitat inhabited by large admixed and genetically highly variable populations.