The major mechanisms of horizontal gene transfer (HGT) in bacteria are natural transformation, conjugation and transduction (phage-mediated transfer of bacterial DNA). In addition to a role in phage resistance, CRISPR–Cas systems have been shown to inhibit conjugation and transformation, whereas their role in transduction is not well understood. Watson et al. show that in Pectobacterium atrosepticum, phage-mediated transduction of plasmids, chromosomal loci and genomic islands can be limited by CRISPR–Cas interference. However, owing to the infrequency of spacers acquired during transduction compared with spacers from phages, they hypothesized that the canonical role of CRISPR–Cas in phage resistance would enhance HGT by increasing the survival of transductants. Indeed, spacer acquisition from phages enabled CRISPR–Cas to protect bacteria from infection and increased the generation of transductants. Finally, bacteria acquired a chromosomal CRISPR–Cas system through transduction.