Gene transfer agents (GTAs) are domesticated bacteriophages that have evolved into molecular machines for the transfer of bacterial DNA. Despite their widespread nature and their biological implications, the mechanisms and selective forces that drive the emergence of GTAs are still poorly understood. Two GTAs have been identified in the Alphaproteobacteria: the RcGTA, which is widely distributed in a broad range of species; and the BaGTA, which has a restricted host range that includes vector-borne intracellular bacteria of the genusBartonella. The RcGTA packages chromosomal DNA randomly, whereas the BaGTA particles contain a relatively higher fraction of genes for host interaction factors that are amplified from a nearby phage-derived origin of replication. In this study, we compare the BaGTA genes with homologous bacteriophage genes identified in the genomes ofBartonellaspecies and close relatives. Unlike the BaGTA, the prophage genes are neither present in all species, nor inserted into homologous genomic sites. Phylogenetic inferences and substitution frequency analyses confirm codivergence of the BaGTA with the host genome, as opposed to multiple integration and recombination events in the prophages. Furthermore, the organization of segments flanking the BaGTA differs from that of the prophages by a few rearrangement events, which have abolished the normal coordination between phage genome replication and phage gene expression. Based on the results of our comparative analysis, we propose a model for how a prophage may be transformed into a GTA that transfers amplified bacterial DNA segments.