(A) We show a schematic representation of an acrIIA22 homolog embedded in a prophage genome, which is integrated into a bacterial genome (contig #57). We can delineate precise boundaries of the inserted prophage based on comparison to a near-identical bacterial contig (contig #55). Prophage genes are colored by functional category, according to the legend at the top. Bacterial genes are colored light gray. (B) Homologs of acrIIA22 are depicted in diverse genomic islands, including Contig #1, whose sequence includes a portion identical to F01A_4, the original metagenomic contig we recovered. All acrIIA22 homologs in these loci are closely related, but their adjacent genes are different, unrelated gene families (depicted by different colors). Genomic regions flanking these hypervariable islands, including genes immediately adjacent to these islands (purF and radC, in bold outlines), are nearly identical to one another (≥98% nucleotide identity). Contigs are numbered to indicate their descriptions in S3 Table, which contains their metadata, taxonomy, and sequence retrieval information. All sequences and annotations may also be found in S2 and S3 Data. (C) We propose an evolutionary model for the origin of the acrIIA22-encoding hypervariable genomic islands depicted in panel B. We propose that acrIIA22 moved via prophage integration into a bacterial genomic locus but remained following an incomplete prophage excision event. Its neighboring genes subsequently diversified via horizontal exchange with additional phage genomes without these phage genomes inserting into the locus. S4 Fig depicts a more detailed version of the genomic data underlying this model.