Environmental Dependence on Prophage Maintenance
Prophages, viral sequences integrated into bacterial genomes can confer fitness benefits and costs. Despite the risk of prophage activation and subsequent bacterial death, active prophages are present in most bacterial genomes. However, our understanding about the selective forces that maintain prophages in bacterial populations is scarce. Combining experimental evolution with stochastic modelling we found that prophage maintenance and loss are primarily determined by environmental conditions that amplify the net fitness effect of the prophage. Whole genome sequencing revealed that prophage loss occurs through environment-specific sequences of selective sweeps, leading to rapid prophage loss when prophage costs outweigh their benefits. However, conflicting selection pressures, that select against the prophage but for a prophage-encoded accessory gene can prolong prophage maintenance. The sociality of this accessory gene further determines the evolutionary trajectory of the lysogen population. Selection for non-cooperative genes maintains prophages at higher frequencies than selection for cooperative genes, which can protect  phage-free 'cheaters' that may emerge if prophage costs outweigh their benefits. Our model suggests that environmental variation plays a stronger role than mutation rates in determining prophage maintenance. This challenges our understanding of the role of random chance events relative to environmental factors in shaping the evolutionary trajectory of bacterial populations.