Spatial distribution of palatable and unpalatable plants can influence the foraging behaviour of herbivores, thereby changing plant-damage probabilities. Moreover, the immediate proximity to certain plants can benefit other plants that grow below them, where toxicity or spines act as a physical barrier or concealment against herbivores. This paper presents the results of a multi-scale experiment performed to test the effect of shrubs as protectors of tree saplings against herbivores and the mechanism involved in Mediterranean ecosystems. We performed a factorial design in two mountain ranges, similar in physiognomy and vegetation, planting saplings of a palatable tree, the maple (Acer opalus subsp. granatense), and an unpalatable tree, the black pine (Pinus nigra), under three different types of shrubs. We considered four experimental microhabitats: highly palatable shrub (Amelanchier ovalis), palatable but spiny shrub (Crataegus monogyna or Prunus ramburii), unpalatable spiny shrub (Berberis vulgaris subsp. australis) and control (gaps of bare soil without shrubs). Three main factors were found to determine the probability of sapling attack: sapling palatability, experimental microhabitat and plot. Palatable saplings (maples) were browsed much more than unpalatable ones (pines). The degree of protection provided by the shrub proved greater as its palatability decreased with respect to sapling palatability, the unpalatable spiny shrub being the safest microhabitat for palatable saplings and bare soil for unpalatable ones. The differences found in number of attacked saplings between plots may be attributable to differences in herbivore pressure. The community context in which interaction takes place, namely the characteristics of the neighbours and the intensity of herbivore pressure, are determining factors for understanding and predicting the damage undergone by a target plant species. The mechanism that best explains these results is associational avoidance of saplings that grow near to unpalatable shrubs. It is necessary to introduce this neighbour effect in theoretical models and food-web approaches that analyse the plant–herbivore relationships, since it can strongly determine not only the intensity of the interaction, but also the spatial distribution and diversity of the plant community.