1. A trophic cascade occurs when predators directly decrease the densities, or change the behaviour, of herbivores and thus indirectly increase plant productivity. The predator-herbi-vore-plant context is well known, but some predators attack species beneficial to plants (e.g. pollinators) and/or enemies of herbivores (e.g. parasites), and their role in the dynamics of mutualisms remains largely unexplored. 2. We surveyed the predatory ant species and studied predation by the dominant ant species, the weaver ant Oecophylla smaragdina, associated with the fig tree Ficus racemosa in southwest China. We then tested the effects of weaver ants on the oviposition behaviour of polli-nating and non-pollinating fig wasps in an ant-exclusion experiment. The effects of weaver ants on fig wasp community structure and fig seed production were then compared between trees with and without O. smaragdina. 3. Oecophylla smaragdina captured more non-pollinating wasps (Platyneura mayri) than poll-inators as the insects arrived to lay eggs. When ants were excluded, more non-pollinators laid eggs into figs and fewer pollinators entered figs. Furthermore, trees with O. smaragdina produced more pollinator offspring and fewer non-pollinator offspring, shifting the community structure significantly. In addition, F. racemosa produced significantly more seeds on trees inhabited by weaver ants. 4. Oecophylla smaragdina predation reverses the dominance of the two commonest wasp species at the egg-laying stage and favours the pollinators. This behavioural pattern is mirrored by wasp offspring production, with pollinators' offspring dominating figs produced by trees inhabited by weaver ants, and offspring of the non-pollinator P. mayri most abundant in figs on trees inhabited by other ants. 5. Overall, our results suggest that predation by weaver ants limits the success of the non-pol-linating P. mayri and therefore indirectly benefits the mutualism by increasing the reproductive success of both the pollinators and the plant. Predation is thus a key functional factor that can shape the community structure of a pollinator-plant mutualistic system.