Plants defend themselves against diverse communities of herbivorous insects. This requires an investment of limited resources, for which plants also compete with neighbours. The consequences of an investment in defence are determined by the metabolic costs of defence as well as indirect or ecological costs through interactions with other organisms. These ecological costs have a potentially strong impact on the evolution of defensive traits, but have proven to be difficult to quantify. We aimed to quantify the relative impact of the direct and indirect or ecological costs and benefits of an investment in plant defence in relation to herbivory and intergenotypic competition for light. Additionally, we evaluated how the benefits of plant defence balance its costs in the context of herbivory and intergenotypic competition. To this end, we utilised a functional-structural plant (FSP) model of Brassica nigra that simulates plant growth and development, morphogenesis, herbivory and plant defence. In the model, a simulated investment in defences affected plant growth by competing with other plant organs for resources and affected the level and distribution of herbivore damage. Our results show that the ecological costs of intergenotypic competition for light are highly detrimental to the fitness of defended plants, as it amplifies the size difference between defended and undefended plants. This leads to herbivore damage counteracting the effects of intergenotypic competition under the assumption that herbivore damage scales with plant size. Additionally, we show that plant defence relies on reducing herbivore damage rather than the dispersion of herbivore damage, which is only beneficial under high levels of herbivore damage. We conclude that the adaptive value of plant defence is highly dependent on ecological interactions and is predominantly determined by the outcome of competition for light.