Mutations are random; the (pathogenic) bacteria (or any living being) will randomly acquire mutations that may be beneficial, deleterious or neutral to its fitness. Only beneficial and neutral mutations will survive the selection. *Random mutations* and *survival of the fittest* are not two independent mechanisms. The random mutations can alter the fitness as I mentioned and natural selection ensures the survival of the fittest. Many pathogens have reduced genome (number of genes) compared to their free living relatives ([Weinert and Welch, 2017][1]). This is because they lack most of the genes required for synthesis of different metabolites required for survival. They rather obtain these metabolites from the host and hence they have the parasitic lifestyle. It is not possible for the pathogens to acquire that many genes to stop being pathogenic and become a free-living organism. It may be possible via [lateral gene transfer][2] wherein a bacteria may obtain an entire (or a set of genes) from another bacteria but the likelihood of that happening to convert a pathogenic bacteria to a non-pathogenic bacteria is negligible. It is certainly possible that pathogens might lose the activity of some of the pathogenic genes (for example those required for toxin production) due to mutations. However, they may no longer be efficient pathogens and would be outgrown by the others who still retain those genes. [1]: https://doi.org/10.1016/j.tree.2017.09.006 [2]: https://en.wikipedia.org/wiki/Horizontal_gene_transfer [3]: https://en.wikipedia.org/wiki/Opportunistic_infection