Bacteria evolve resistance to antibiotics more slowly if they also have to defend themselves against predators.