Migration of hosts and parasites can have a profound impact on host-parasite ecological and evolutionary interactions. Using the bacterium Pseudomonas aeruginosa UCBPP-PA14 and its phage DMS3vir, we here show that immigration of naive hosts into coevolving populations of hosts and parasites can influence the mechanistic basis underlying host defence evolution. Specifically, we found that at high levels of bacterial immigration, bacteria switched from clustered regularly interspaced short palindromic repeats (CRISPR-Cas) to surface modification-mediated defence. This effect emerges from an increase in the force of infection, which tips the balance from CRISPR to surface modification-based defence owing to the induced and fixed fitness costs associated with these mechanisms, respectively.