Understanding the interactions between bacteria and their viruses is important, because of the increasing interest in using these viruses as alternatives for - or in combination with - antibiotics. Understanding interactions between bacteria and mobile pieces of DNA, such as plasmids, is also important, because these mobile pieces of DNA can move important genes between bacteria that for example confer antibiotics resistance or virulence determinants. Bacterial immune systems, which protect against these viruses and mobile pieces of DNA, play a key role in mediating these interactions. Bacteria have a range of immune mechanisms, but it is unclear why this diverse armamentarium evolved. The most important immune mechanisms are (1) Surface Modification (SM) (2) Abortive infection (Abi) (3) Restriction Modification (R-M) (4) CRISPR-Cas and (5) prokaryotic Argonaute (pAgo), all of which can occur as stand-alone mechanisms or in combination. This project applies a combined in vitro and in vivo approaches to tease apart the variables that drive the evolution of these diverse stand-alone and integrated bacterial immune strategies in nature, and examine their associated co-evolutionary dynamics. In vitro manipulations using the opportunistic human pathogen Pseudomonas aeruginosa PA14, equipped with either single or multiple immune mechanisms will identify important drivers of resistance strategies. Metagenomics, transcriptomics and viromics will provide observational data from environments that differ in ecological variables that are important in vitro, to examine their importance in vivo. Key ecological mechanisms identified in the first two parts of the project will be used to guide mesocosm experiments to experimentally confirm that these mechanisms are the drivers of the observed patterns of resistance and co-evolution in nature. Finally, data are shared with mathematical biologists to generate theoretical models to predict and manipulate the evolution of bacterial immune mechanisms.