Carriage of resistance genes can underpin bacterial survival, and by spreading these genes between species, mobile genetic elements (MGEs) can potentially protect diversity within microbial communities. The spread of MGEs could be affected by environmental factors such as selection for resistance, and biological factors such as plasmid host range, with consequences for individual species and for community structure. Here we cultured a focal bacterial strain, Pseudomonas fluorescens SBW25, embedded within a soil microbial community, with and without mercury selection, and with and without mercury resistance plasmids (pQBR57 or pQBR103), to investigate the effects of selection and resistance gene introduction on (1) the focal species; (2) the community as a whole; (3) the spread of the introduced mer resistance operon. We found that P. fluorescens SBW25 only escaped competitive exclusion by other members of community under mercury selection, even when it did not begin with a mercury resistance plasmid, due to its propensity to acquire resistance from the community by horizontal gene transfer. Mercury pollution had a significant effect on community structure, decreasing alpha diversity within communities while increasing beta diversity between communities, a pattern that was not affected by the introduction of mercury resistance plasmids by P. fluorescens SBW25. Nevertheless, the introduced merA gene spread to a phylogenetically diverse set of recipients over the 5 weeks of the experiment, as assessed by epicPCR. Our data demonstrates how the effects of MGEs can be experimentally assessed for individual lineages, the wider community, and for the spread of adaptive traits.