Predators and parasitoids of herbivores can play important roles in plant defense. Plant traits that attract the enemies of herbivores are presumed to have co-evolved with these enemies in obligate relationships such as ant-Acacia mutualisms, In facultative interactions, selection via herbivores' enemies also may shape plant traits, although no study has yet demonstrated all of the necessary criteria to document selection in a single tri-trophic system. Using manipulative experiments during a two-year study, I showed that predatory ants can act as agents of selection on extrafloral nectary (EFN) traits. Wild cotton (Gossypium thurberi) EFNs attract a number of generalist ant species that consume and disturb herbivores. Sire-offspring regression analyses demonstrated that both the proportion of leaves with EFNs and EFN size exhibit heritable variation in G. thurberi. A two-year insecticide experiment revealed that herbivory reduced plant growth and seed production in the field, independently of the effects of ants. Both ant abundance and EFN availability were manipulated in the field using a 2 X 2 factorial design. When ant visitation was reduced, plants supported more herbivores, experienced greater leaf damage, and produced fewer flowers and seeds. Furthermore, fewer ants visited plants with experimentally reduced EFNs; leaf damage was higher and seed number was lower compared to plants with ambient levels of. EFN, indicating that EFNs mediate the benefits of ants. In addition, natural variation in EFN frequency correlated positively with seed production. This study provides the strongest support yet that casual ant associates can influence the evolution of extrafloral nectary traits and suggests that plant evolution in facultative mutualisms depends on community-level dynamics.