Legume plants host nitrogen-fixing endosymbiotic Rhizobium bacteria in root nodules. In Medicago truncatula, the bacteria undergo an irreversible (terminal) differentiation mediated by hitherto unidentified plant factors. We demonstrated that these factors are nodule-specific cysteine-rich (NCR) peptides that are targeted to the bacteria and enter the bacterial membrane and cytosol. Obstruction of NCR transport in the dnf1-1 signal peptidase mutant correlated with the absence of terminal bacterial differentiation. On the contrary, ectopic expression of NCRs in legumes devoid of NCRs or challenge of cultured rhizobia with peptides provoked symptoms of terminal differentiation. Because NCRs resemble antimicrobial peptides, our findings reveal a previously unknown innovation of the host plant, which adopts effectors of the innate immune system for symbiosis to manipulate the cell fate of endosymbiotic bacteria.