Nectar is what flowers give to pollinators in exchange for help with fertilization; nectar is also what nectar robbers and florivores try to steal, and microorganisms try to contaminate. Flowers have evolved a variety of defense mechanisms to protect themselves from such attack. The flowers of wild tobacco, Nicotiana attenuata, produce several nectarin proteins that are known to be involved in producing reactive oxygen species in nectar. However, the function of nectarins is not clear in vivo. Here we used CRISPR techniques to induce mutations in the target genes coding for nectarins and released these mutants into N. attenuata’s native habitat (the Great Basin Desert, Utah, USA) to examine the function of nectarins in nature. We found that nectarin proteins in flowers play important roles in plant-microorganism and plant-herbivore interactions. This study shows that genome-editing techniques can be used to verify the ecological function of genes in non-model plants.