Pathogenic and mutualistic bacteria associated with eukaryotic hosts often lack distinctive genomic features, suggesting regular transitions between these lifestyles. Here we present evidence supporting a dynamic transition from plant pathogenicity to insect-defensive mutualism in symbiotic Burkholderia gladioli bacteria. In a group of herbivorous beetles, these symbionts protect the vulnerable egg stage against detrimental microbes. The production of a blend of antibiotics by B. gladioli, including toxoflavin, caryoynencin and two new antimicrobial compounds, the macrolide lagriene and the isothiocyanate sinapigladioside, likely mediate this defensive role. In addition to vertical transmission, these insect symbionts can be exchanged via the host plant and retain the ability to initiate systemic plant infection at the expense of the plant's fitness. Our findings provide a paradigm for the transition between pathogenic and mutualistic lifestyles and shed light on the evolution and chemical ecology of this defensive mutualism.