Natural selection ultimately acts on genes and other DNA sequences. Adaptations that are good for the gene can have adverse effects at higher levels of organization, including the individual or the population. Mobile genetic elements illustrate this principle well, because they can self-replicate within a genome at a cost to their host. As they are costly and can be transmitted horizontally, mobile elements can be seen as genomic parasites. It has been suggested that mobile elements may cause the extinction of their host populations. In organisms with very large populations, such as most bacteria, individual selection is highly effective in purging genomes of deleterious elements, suggesting that extinction is unlikely. Here we investigate the conditions under which mobile DNA can drive bacterial lineages to extinction. We use a range of epidemiological and ecological models to show that harmful mobile DNA can invade, and drive populations to extinction, provided their transmission rate is high and that mobile element-induced mortality is not too high. Population extinction becomes more likely when there are more elements in the population. Even if elements are costly, extinction can still occur because of the combined effect of horizontal gene transfer, a mortality induced by mobile elements. Our study highlights the potential of mobile DNA to be selected at the population level, as well as at the individual level.