The optimal defence theory assumes that there is a cost associated with the production of defences against herbivores in plants and that plants evolve and allocate defences to maximize individual inclusive fitness. We analyse how a plant should allocate its resources between biomass production and production of defences in order to maximize net growth. In general it is optimal for a plant to have a defence, the intensity of which increases with grazing pressure. However, there is a threshold grazing intensity below which it is optimal not to have a defence. In addition, there is one threshold above which it is necessary (i.e. not only optimal) to have a defence and one defining the highest sustainable grazing level. A plant subjected to an increased level of stress should give priority to, rather than sacrifice, defence. On an evolutionary time scale the efficiency of a defence system seems to be important in a qualitative way. Only if the efficiency is initially above a certain critical value do we expect the defence system to evolve into a more efficient one. Therefore, different taxa, despite being subjected to similar selection pressures, might evolve in opposite directions depending on the initial conditions.