Introduction

With the rapid expansion of human populations and anthropogenic areas encroaching on wildlife habitat, contact zones and subsequent interactions between humans and wildlife are increasing (Anand & Radhakrishna, 2017; Bloomfield et al., 2020; Nyhus, 2016). The conversion of natural habitats into agricultural lands leads to a loss of natural resources for wildlife, but it also brings new resources to species, which are able to exploit them (Fehlmann et al., 2021). However, because the use of agricultural resources by animals negatively impacts human livelihoods, it can lead to human-wildlife conflicts, which can represent a real threat to the long-term survival of species (Strum, 2010; Woodroffe et al., 2005).

Nonhuman primates (hereafter “primates”), especially macaques, baboons, and vervets, with their high dietary and behavioral flexibility, are particularly successful at exploiting agricultural food resources and are commonly considered as agricultural pests (Hill, 2017; McLennan et al., 2017). Farmers employ various methods to deter primates from foraging on crops. The most commonly used deterrents include barriers and fences, crop-guarding techniques, alarm systems, and chasing (Findlay & Hill, 2020; Hill & Wallace, 2012; Strum, 2010). Some of these methods can be violent, for instance chasing primates with packs of dogs or with weapons, and can result in lethal injuries (Strum, 2010). Crop-foraging primates exhibit a range of strategies to avoid such interactions. These strategies may involve shifting their activity periods to visit crops at times of low human activity (chimpanzees, Pan troglodytes: Krief et al., 2014) and minimizing risks of detection by reducing resting and social time in cultivated areas (chimpanzees: Bryson-Morrison et al., 2017; geladas, Theropithecus gelada: Caselli et al., 2021). In several species, adult or subadult males are more likely to forage in crops than other age and sex classes, as they appear to be more willing to engage in risky activities (chimpanzees: Hockings et al., 2007; Buton macaques, Macaca ochreata brunnescens: Priston, 2005; vervets, Chlorocebus aethiops pygerthus: Saj et al., 1999; olive baboons, Papio anubis: Strum, 1994).

Given the projected increase in human-primate conflicts, it is imperative to identify effective solutions for managing these conflicts (Campbell-Smith et al., 2010; Marchal & Hill, 2009). Achieving this goal first requires understanding the behavior of crop-foraging primates, which may be both species-specific and location-specific and thus requires case-by-case analyses (Hill, 2017). By gaining insights into crop-foraging primates’ behavioral patterns, one can develop targeted and informed strategies to mitigate these conflicts successfully (Hill, 2017).

The Endangered Barbary macaque (Macaca sylvanus; Wallis et al., 2020) inhabits temperate mountainous forests in Morocco and Algeria. The Middle-Atlas Mountains of Morocco host approximately 75% of the global Barbary macaque population (Fa, 1984; Taub, 1977) and are under increasing anthropogenic pressure, with intense livestock grazing and progressive conversion of forest-adjacent lands into agricultural lands (Kouba et al., 2018). With their high behavioral and dietary flexibility, Barbary macaques have colonized anthropogenic habitats such as peri-urban and agricultural areas where they are able to forage on human food resources (Maibeche et al., 2015). While macaques are particularly efficient crop-foragers due to their behavioral flexibility, aptitude for social learning and semiterrestrial locomotion (Hill, 2017), the specific behaviors exhibited by crop-foraging Barbary macaques have not yet been studied.

In this study, we examined the behavioral adaptations of Barbary macaque groups to anthropogenic disturbances at the interface between an evergreen cedar-oak forest and agricultural areas in the Middle-Atlas in Morocco. We also quantified their agonistic and nonagonistic interactions with local people. Because crop-foraging primates considered as agricultural pests, such as macaques, are typically the targets of human aggression (Hill, 2017; Strum, 2010), we assumed that humans display aggressive behaviors towards crop-foraging Barbary macaques, and we hypothesized that the macaques use strategies to mitigate the resulting risk. Specifically, we predicted that they minimize the risks of encounters with humans by minimizing the time spent in the riskiest areas (i.e., cultivated areas), which should be devoted mainly to crop-foraging, while resting and socializing are preferentially performed in safer areas (i.e., forests). To test this prediction, we examined how the groups’ activity budgets vary between cultivated and forested areas. Because two different types of agrosystems are present at the study site (fruit orchards and cereal field), we also examined activity-budget variations between those habitats. We also predicted that the macaques will predominantly visit risky areas when human activity is low and that adult males will spend more time in cultivated areas than adult females and immatures. Finally, we identified the strategies used by the local human population to deter macaques from crop-foraging and assessed which, if any, are effective. To that end, we quantified human behaviors during encounters with the macaques and the macaques’ responses to those different types of behaviors, especially regarding their movements away or towards the cultivated areas.

Methods

Site and Subjects

We conducted the study in the Middle-Atlas Mountains in the Ifrane Province of Morocco, at the interface of an evergreen cedar-oak forest (Quercus rotundifolia and Cedrus atlantica) and agricultural lands (Fig. 1) near the rural village of Aïn Leuh (5° 20’W, 33° 18’N; 1400–1700 m altitude; mean annual temperatures: minimum 9.5, maximum 21.1 °C; mean annual rainfall: 830 mm). The evergreen cedar-oak forest encompassed approximately 80% of mature forest and 20% of pure oak coppices <5 m high (Sogreah-Ttoba, 2004). During the past decade, the area has undergone agricultural development, with the conversion of open areas traditionally used as extensive pastures into crops. The study site encompassed 14.2 ha of cherry and walnut orchards and one 0.2-ha cereal field where wheat was grown (Fig. 1). Humans were present daily in the study area, both in agricultural and forested zones. Humans in agricultural areas were mainly agricultural workers, mostly present from 9 am to 6 pm. Humans in the forest were mainly shepherds leading sheep and goats to graze. We studied three groups of macaques during three observation seasons, in the fall (October–November) of 2021 and in the spring (May–June) and summer (July–August) of 2022. We followed the primary focal group (Depog) during all three seasons. This group consisted of 28 individuals in 2021. Three adult females and two immatures disappeared and three infants were born, resulting in a total of 26 individuals in 2022. We could identify all members of Depog group individually. We followed Houpette group (37 individuals) only in the fall of 2021, as we could not locate it in the following spring. We followed Felix group (approximately 35 individuals) only in 2022. We could not identify all members of Houpette and Felix groups individually.

Fig. 1
figure 1

Aïn Leuh study site, Morocco, in 2021, with land types and home range of the focal Barbary macaque group, Depog. We estimated home range size using the kernel density estimation method (Supporting Information and Neves et al., 2023a).

Data Collection

Every 15 minutes, we used instantaneous scan sampling (Altmann, 1974) to record the activity of five individuals, excluding infants <1 year old. We chose the first individual haphazardly among all individuals in sight, then observed the others from right to left from the first individual. We divided activities into five mutually exclusive categories: foraging (i.e., searching for food items, including turning over stones, digging into the ground, searching beneath litter, hunting insects, and cleaning plant items), feeding (i.e., actually eating food items), moving (i.e., any type of locomotion that was not associated with another activity), resting (i.e., all inactive postures not associated with another activity), and socializing (i.e., all interindividual affiliative or agonistic interactions). We recorded 6007 scans for Depog group in 705 hours of observation, 732 scans for Houpette group in 94 hours of observation, and 446 scans for Felix group in 88 hours of observation.

We recorded all occurrences when Barbary macaques experienced anthropogenic disturbances, which we define as encounters with humans and domestic animals, including dogs and livestock (referred to as “disturbers”). For each encounter, we recorded the behavior of the disturber (Table 1), its distance to the closest macaques, and the duration of the encounter. We also recorded the reaction of the macaques (Table 1), the distance they fled if they fled, and the time it took them to resume their previous activity or engage in a new activity that was not vigilance, fleeing, or interacting with the disturber. During observation sessions, we recorded the location of the groups every 30 min by using a GPS Trimble TERMINAL JUNO 5B, with an uncertainty of approximately 5 m, as estimated by the manufacturer. Additionally, we recorded the macaques’ location at the time of each anthropogenic encounter and again 1 hr later.

Table 1 Ethogram for humans, dogs and livestock (“disturbers”) and Barbary macaques during encounters in Aïn Leuh, Morocco, in 2021–2022

Data Analysis

Activity Patterns

We estimated the daily activity-budgets of each group from the scans. The activity budgets of Barbary macaques differ between age and sex classes (Ménard & Vallet, 1997). To account for those differences, we calculated mean daily activity budgets for each group as the weighted mean of three age-sex classes, based on group compositions observed at several other study sites (Ménard, 2002), which are one quarter adult females (>4 years old), one quarter adult males (>5 years old), and one half immatures (excluding infants <1 year old). We present activity budgets as a percentage of daylight time (i.e., between sunrise and sunset) spent in each activity. Daylight time varies between 10 and 14 hr depending on the season. We tested the effects of habitat (forest, orchard, or cereal field) and group ID (Depog, Houpette, and Felix) on the groups’ activity budgets using generalized linear mixed models (GLMM, Baayen et al., 2008). “Forested areas” encompass high forests and oak coppices and a few grassland formations. Because the response variables are continuous percentages, we used a beta error structure with logit link function (Salinas Ruíz et al., 2023). We ran five models, one for each activity (i.e., foraging, feeding, moving, resting, and socializing). In each model, we included the month and observation day as random effects. When a model showed a significant effect, we ran post-hoc Tukey’s tests to determine between which habitats the activity budgets differed. We performed all analyses by using the R software (R Core Team, 2020). We built the GLMMs using the “glmmTMB” R package (Brooks et al., 2017) and performed Tukey’s tests by using the “lsmeans” R package (Lenth, 2016). We ran residual diagnostics for all GLMMs using the “DHARMa” R package (Hartig, 2021) to ensure that all model assumptions were met.

Use of Cultivated Areas

To assess differences in the presence of the different age-sex classes in cultivated areas, we calculated the proportion of scans made each day for each of three age-sex classes (adult females, adult males, and immatures) in the three habitats (forest, orchard, and cereal field). We used those proportions as a proxy for relative presence of the three age-sex classes in the cultivated areas. We used binomial GLMMs (one for each age-sex class) to test the effect of habitat and group ID on the proportion of scans. We added the month and observation day as random effects to the models. When a model showed a significant effect, we ran post-hoc Tukey’s tests to determine between which habitats the relative presence of an age-sex class differed. To determine whether the macaques visited cultivated areas more frequently at specific times of day, we divided the day into five periods from sunrise to sunset: 6 am–9 am; 9 am–12 pm; 12 pm–3 pm; 3 pm–6 pm; and 6 pm–9 pm. Using binomial GLMMs, we assessed the effects of the period of the day, month, and group ID on the macaques’ presence in cultivated areas. Again, we added the observation day as a random effect. We then ran post-hoc Tukey’s tests to determine between which periods of the day and between which months the percentage of time spent by macaques in cultivated areas differed.

Human-macaque Interactions

For each month, we calculated hourly rates of anthropogenic encounters as the number of encounters between macaques and humans or domestic animals divided by the number of hours of observation. Observation sessions lasted a mean of 9 hr (minimum: 1 hr, maximum: 14 hr). We defined encounters as any interaction with a human or domestic animal, regardless of whether it was aggressive or not. We defined aggressive encounters as those including physical aggression, such as chasing or throwing projectiles, or nonphysical aggression, such as shouting/barking or directing loud noises at the macaques. We included instances where humans or domestic animals passed close enough to be visible by the macaques, but the macaques did not exhibit a visible reaction to their presence. We assumed that when humans or domestic animals were visible to the researchers (positioned within 30 m of the macaques), they were also visible to the macaques, and vice versa.

To investigate the effectiveness of the various strategies implemented by the local human population to keep the macaques out of the cultivated areas, we used a co-inertia analysis (COA). Co-inertia analysis identifies relationships between two sets of variables, based on separate standard multivariate analyses on each of the datasets, which are then connected (Dolédec & Chessel, 1994). In this case, one of the two datasets contained data on the nature of the anthropogenic encounters, and the other contained data on the macaques’ reactions. Both tables share the same rows, each representing one encounter event (N = 485) and gather binary variables with values being either “yes” or “no.” The first table contains three variables regarding the identity of the disturber (either human, dog, or human accompanied by dog) and six regarding the type of behavior towards the macaques: neutral, projectile, noise, nonagonistic interaction, barking, or chasing (Table 1). The second dataset contains four variables regarding the macaques’ reactions to the encounters: defense, fleeing, alarm call, or no visible reaction (Table 1). The standard analyses made on each dataset were multiple correspondence analyses (MCA), which detect underlying structures in a dataset containing categorical variables, bringing out a principal axis which is the vector direction maximizing the inertia in each dataset (Dolédec & Chessel, 1994). COA then identifies dimensions in both MCAs which are maximally correlated with each other. It thus identifies similar associations present in both datasets, which explain their relationships. We assessed whether there was a significant correlation between the tables using Monte Carlo random permutation tests with 1000 permutations. We assessed the correlation between each variable and each co-inertia axis graphically via the angle between the axis and the arrow from the origin of the COA factorial plan to the variable: an acute angle indicates a positive correlation, an obtuse angle a negative correlation, and a 90° angle indicates no correlation. Variables which display the same type of correlation with the axes are considered as associated. The normed scores of the statistical individuals (i.e., the encounter events) provide insight into how the individuals relate to the variables in each dataset. Individuals with higher scores on a particular axis are more influenced by the variables associated with that axis. We tested whether those scores explained variation in three additional variables: the distances fled by the macaques (in meters), the proportion of time they spent in cultivated areas that day, and the time before resuming a normal activity (in seconds). To do this, we regressed, on each axis of the COA, the normed scores of the statistical individuals with the three variables using linear regression. We performed the COA analysis by using the “ade4” R package (Thioulouse et al., 2018).

To evaluate the impact of aggression by humans or dogs on the presence of macaques in cultivated areas, we estimated the distance of the groups from the cultivated areas at the time of each aggression by humans or dogs, and 1 hr later, using GPS locations of the groups. We considered that a group had moved closer to the cultivated areas if its distance to these areas had decreased by at least 20 m 1 hr later. Conversely, we considered a group as having moved away if its distance from the cultivated areas had increased by more than 20 m. This minimum distance of 20 m accounts for the uncertainty in GPS accuracy. We tested whether the location of the aggression (in cultivated or forested areas) influenced the closeness of the groups to the cultivated areas in the next hour using a chi-square test with Monte Carlo simulation.

Ethical Statement

Our research complied with Moroccan laws, followed the IPS Code of Best Practices for Field Primatology, and was conducted in close partnership with Moroccan Forestry authorities, under DLCDPN permits n°385 and 1367. All data collection was non-invasive. The authors declare no conflict of interest.

Data Availability Statement

The datasets generated and analyzed during the current study are available in an online OSF repository accessible at https://osf.io/v2j7c/.

Results

Activity Patterns

Activity budgets varied between habitats with macaques spending two to three times more time feeding in cultivated areas than in forested areas (Fig. 2; Table 2). The macaques moved less when they were in the field than in the orchards or the forest (Fig. 2; Table 2). Resting time was highest in the forest and was twice as high in the orchards compared with the field (Fig. 2; Table 2). Socializing time was higher in the forest than in both types of cultivated areas (Fig. 2; Table 2). Group ID had no effect on time spent on any activity (Table 2).

Fig. 2
figure 2

Mean and standard deviation time spent in different activities in different habitats by Barbary macaques in Aïn Leuh, Morocco, in the fall of 2021 and spring-summer of 2022. Asterisks indicate significant differences based on post-hoc Tukey tests following generalized linear mixed models (Table 2).

Table 2 Results of generalized linear mixed models comparing the time spent in different activities in different habitats by Barbary macaques in Aïn Leuh, Morocco, in the fall of 2021 and spring-summer of 2022, and effect of group ID on each activity. Numbers in bold indicate significant p values

Use of Cultivated Areas

The macaques visited cultivated areas on 89 of 98 observation days (91%). They spent 35.9% of observation time (N = 887 hours) in cultivated areas, with 279.9 hours in the orchards and 38.9 hours in the cereal field. The mean duration of visits was 128 ± SD 151 min in orchards and 68 ± SD 44 min in the cereal field, with high variability across visits and months. Minimum mean visit durations were 28 ± SD 22 min (June) in orchards and 9 min in the field (May, only one visit). Maximum mean durations were 321 ± SD 208 min in orchards (August) and 102 ± SD 73 min in the field (November). The relative presence of adult males and immatures was similar in the three habitats (Fig. 3; Table 3). Adult females represented a greater proportion of the group in the cereal field than the forest (Fig. 3; Table 3). Group ID had no effect on the relative presence of either age-sex class in the three habitats (Table 3).

Fig. 3
figure 3

Mean (and standard deviation) for the relative presence of three Barbary macaque age-sex classes in each habitat in Aïn Leuh, Morocco, in the fall of 2021 and spring-summer of 2022. Asterisks indicate significant differences based on post-hoc Tukey tests following generalized linear mixed models (Table 3).

Table 3 Results of generalized linear mixed models comparing the relative presence of three Barbary macaque age-sex classes in three habitats in Aïn Leuh, Morocco, in the fall of 2021 and spring-summer of 2022, and effect of group ID. Numbers in bold show significant p values.

The period of the day and the month both had significant effects on the presence of macaques in cultivated areas (period of the day: GLMM, \({\upchi }^{2}\) = 147.95, df = 4, p < 0.001; month: GLMM, \({\upchi }^{2}\) = 81.2, df = 5, p < 0.001). Group ID had no effect on macaque presence in cultivated areas between periods of the day (GLMM, \({\upchi }^{2}\) = 0.03, df = 2, p = 0.98) or between months (GLMM, \({\upchi }^{2}\) = 1.05, df = 2, p = 0.59). The macaques spent little time inside the cultivated areas before 9am (Fig. 4a), less than in any other period (post-hoc Tukey tests p < 0.001, Table S1). The percentage of time spent in cultivated areas then increased until it reached 50–60% between 12 pm and 6 pm (Fig. 4a), higher than in any other period (post-hoc Tukey tests p < 0.001, Table S1). The macaques moved from the cultivated areas to their sleeping sites in the forest quite late in the day, as they still spent 25% of the time inside cultivated areas between 6 pm and 9 pm. They spent most of the daytime in cultivated areas in July, August, and November (≥5 hours per day, i.e., ≥50% of their time; Fig. 4b). They spent significantly less time in cultivated areas in May, June and October (<3 hours per day, i.e., <25% of their time, Fig. 4b; post-hoc Tukey tests p ≤ 0.01, Table S2).

Fig. 4
figure 4

a) Mean percentage (and standard deviations) of daytime that Barbary macaques spent in cultivated areas for each period of the day in Aïn Leuh, Morocco, in the fall of 2021 and spring-summer of 2022. b) Mean daily time spent by the macaques in cultivated areas each month. Mean day length (in hours) for each month in shown above each bar.

Human-macaque Interactions

Mean hourly rates of anthropogenic encounters varied between 0.34/hr in November and 0.67/hr in July (Fig. 5). The encounters were with four types of disturbers: humans and dogs, who often displayed aggression towards the macaques, livestock, who never displayed aggression towards the macaques, and passing vehicles (Fig. 5). Patterns of human aggression towards the macaques varied over the 6 months of observation. Systematic guarding of cultivated areas occurred solely in May and early June, after which the guards were no longer present at the site. The guards employed various methods to deter macaques from crops, including throwing rocks using slingshots, shouting, and creating loud noises by hitting the metal guardrails along the road that separated the orchards from the forest (Fig. 1). In July, August, October, and November, human aggression primarily came from people living or working near the orchards, throwing projectiles (rocks and sticks), shouting at the macaques, and encouraging domestic dogs to chase them. We never observed macaque aggression towards humans. We observed macaque aggression towards dogs only once when two adult males lunged towards a dog after it had chased a juvenile.

Fig. 5
figure 5

Mean monthly rates of encounters between Barbary macaques and humans, dogs, livestock, and vehicles each month and behaviors of humans and dogs in Aïn Leuh, Morocco, in the fall of 2021 and spring-summer of 2022.

We retained the first two axes of the COA between anthropogenic encounters and macaques’ reactions (Fig. 6). The first axis accounted for 75% of the total covariance between the two tables, whereas the second axis accounted for 15%. The correlation between the two tables was highly significant (Monte Carlo simulation, p = 0.001). The first axis opposes the encounters with dogs alone on the positive part and with humans alone on the negative part (Fig. 6). Fleeing was associated with the first axis on the negative part, as well as projectiles and nonviolent interactions, although projectiles contributed more to the axis than nonviolent interactions. This means that humans alone induced fleeing reactions when displaying overtly aggressive behaviors, such as throwing projectiles, but also, to a lesser extent, when displaying nonaggressive behaviors, such as trying to feed the macaques. By contrast, dogs alone tended to induce alarm calls, defense postures, or no visible reactions from the macaques. The second axis characterizes macaque reactions to noises, opposing barking dogs on the positive part to human noises on the negative part. Human noises, associated with neutral encounters, induced little reaction from the macaques, whereas barking dogs were strongly associated with alarm calls.

Fig. 6
figure 6

Co-inertia analysis for Barbary macaque responses to anthropogenic disturbances in Aïn Leuh, Morocco, in the fall of 2021 and spring-summer of 2022. In green (♦) are the types of disturbers: Human: humans only; Dog: dogs only; Human & dog: humans and dogs together. In blue (●) are the disturbers’ behaviors: Projectile: humans throwing projectiles; Noise: humans directing loud noises at macaques; Nonviolent: humans interacting non-agonistically with the macaques; Chasing: dogs chasing macaques; Barking: dogs barking at macaques; Neutral: humans and/or dogs passing by. In orange (■) are the macaques’ reactions.

The linear regressions on the normed scores of the encounter events showed that distances fled were significantly negatively correlated with human encounters on the first axis (linear regression: F1,205 = 43.69, R2adj = 0.17, p < 0.001) but showed no significant correlation on the second axis (F1,205 = 0.003, R2adj = −0.005, p = 0.95). This means that individual macaques fled further when encountering humans than dogs (when fleeing humans, mean: 17 m, range 1–60 m; when fleeing dogs, mean: 9 m, range 2–30 m) but that fleeing distance was not correlated with the types of anthropogenic noise. Time spent in cultivated areas by macaques also increased on the negative part of the first axis (F1,486 = 29.52, R2adj = 0.05, p < 0.001), which confirms that when macaques spend more time in those areas, they receive more aggression from humans. Time spent by macaques in cultivated areas was not significantly correlated with the second axis (F1,486 = 0.05, R2adj = −0.002, p = 0.82), which means that time spent in cultivated areas was not significantly correlated with barking dogs or human noises. Time before resuming a normal activity after a disturbance (mean 102 seconds, range 5–3240 seconds) was not significantly correlated with any of the COA axes (Axis 1: F1,96 = 2.38, R2adj = 0.01, p = 0.13; Axis 2: F1,96 = 0.17, R2adj = 0.009, p = 0.68), meaning that the type of anthropogenic disturbance did not influence the duration of macaque responses.

The macaques’ distance to the cultivated areas one hour after receiving aggression from humans and/or dogs depended on their location at the time of the aggression (\({\upchi }^{2}\) test with Monte Carlo simulation: N = 117, \({\upchi }^{2}\) = 32.95, p < 0.001). When the macaques were in cultivated areas at the time of aggression, they were more likely to have remained in those areas one hour later than to have moved away from them (Fig. 7). By contrast, when they were in forested areas at the time of aggression, they were more likely to have moved farther away from cultivated areas one hour later (mean 97 m, range 29–325 m) than to have moved closer. Human aggression towards macaques in forested rather than cultivated areas occurred mainly in May when guards were monitoring the crops (percentage of human aggression in forested areas: 100% in May; 50% in June; 23% in July, 8% in August; 37% in October; 50% in November).

Fig. 7
figure 7

Frequency with which Barbary macaques were closer, farther, or at the same distance from cultivated areas one hour after aggression compared to the time of the aggression in Aïn Leuh, Morocco, in the fall of 2021 and spring-summer of 2022.

Discussion

Barbary macaques living at the edge of an agricultural landscape in Aïn Leuh, Morocco, spent a large portion of their time in cultivated areas, particularly orchards. They frequently encountered anthropogenic disturbers and received aggression from both humans and dogs. They showed different activity patterns in the cultivated areas compared to the forest. Contrary to our predictions, they did not avoid cultivated areas when humans were present, and males did not use those risky areas more than females or immatures. The macaques seemed more afraid of humans than dogs, as shown by their greater fleeing responses. However, they generally did not leave the cultivated areas when attacked by either humans or dogs, but they did tend to move back into the forest when attacked before they entered the cultivated areas.

Macaque Behavior in Cultivated Areas

Barbary macaques in Aïn Leuh used cultivated areas extensively, where they did not allocate as much time to resting and socializing as in the forest. This suggests that the macaques perceive cultivated areas as more dangerous than the forest, as minimizing the time devoted to activities, which do not need to be performed in risky areas could be a strategy to reduce the risk of detection by humans. However, when in the orchards, they did spend a significant portion of their time resting (21.8%), which indicates that those areas are not used exclusively as foraging and feeding grounds. Macaques spent half as much time resting in the cereal field as they did in the orchards, which is unsurprising considering that Barbary macaques usually rest in trees, which were absent in the field.

Macaques used cultivated areas frequently and for long periods, especially orchards. While few studies have quantified the use of orchards by primates, our results are similar to those for robust capuchin monkeys (Sapajus robustus) in Brazil, which also spent a large proportion of their time in orchards in some months (Martins et al., 2022). In Malaysia, Southern pig-tailed macaques (Macaca nemestrina) visited oil palm plantations daily, with visits lasting 3 hr on average (Holzner et al., 2021). By contrast, primates typically only spend a short time in crop fields, for example under 3 min for chacma baboons (Papio hamadryas ursinus) in graminoid fields in Zimbabwe (Schweitzer et al., 2017) and on average 14 min for rhesus macaques (Macaca mulatta) in graminoid and vegetable fields in India (Anand & Radhakrishna, 2022). These patterns of crop field use are quite different from those observed in Aïn Leuh, where Barbary macaques’ average use of the cereal field lasted over one hour. Moreover, olive baboons in Nigeria minimized the risk of human detection by transporting cultivated foods out of the crop fields and eating them in safe locations (Warren et al., 2010), while we rarely saw macaques in Aïn Leuh transporting food from cultivated to forested areas. In South Africa, the core home range of a crop-foraging chacma baboon did not overlap with fields (Walton et al., 2021), whereas nearly 20% of the home range of Depog group in Aïn Leuh comprised cultivated areas (Fig. 1; Neves et al., 2023a). Overall, those results suggest that Barbary macaques do not perceive cultivated areas as highly risky. In the cereal field, this finding could be explained by low levels of human retaliation and proximity to the forest edge. In the orchards, it could be explained by the fact that mature orchards resemble small forests, providing ample opportunities for macaques to hide from humans and dogs. However, these patterns of extensive crop use also can be explained by the possibility that the benefits of crop-foraging outweigh the costs due to the scarcity of natural resources at our study site. While we did not quantify resource availability in Aïn Leuh, we observed clear signs of habitat degradation, particularly in the herbaceous layer which suffered from heavy grazing by sheep and goats. Overgrazing has dramatically increased in the Middle-Atlas over the last decades and is largely responsible for the high levels of land degradation in the region (Kouba et al., 2018).

The higher presence of females in the cereal field, relative to males and immatures, was contrary to our predictions. Typically, in primates, adult males, being larger and stronger, tend to engage in riskier behaviors than other age-sex classes, which involves more crop visits (chimpanzees: Hockings et al., 2007; olive baboons: Strum, 1994), spending more time in crops (vervets: Saj et al., 1999), and leading the group into crops (Buton macaques: Priston, 2005). However, in chacma baboons, both males and females initiate crop-foraging events (Schweitzer et al., 2017). In Sumatran orangutans (Pongo abelii), females were more likely to forage in crops than males (Campbell-Smith et al., 2011). It has been suggested that when crop-foraging risks are high, males are more likely to forage on crops than females (Humle & Hill, 2016). However, when levels of retaliation by humans are low, females may forage on crops as frequently or even more than males due to their higher needs to meet reproductive demands (Humle & Hill, 2016). In Aïn Leuh, the cereal field was not as important to farmers as the orchards. The fruits in the orchards were primarily grown for commercial purposes, making them a crucial source of revenue. In contrast, cereals were not sold. After harvesting, they remained in the field to feed passing herds of livestock. Farmers were thus less inclined to chase away macaques from the field than from the orchards, which could have led female macaques to feel relatively safe in the field. Additionally, the cereal field was directly adjacent to the forest, unlike the orchards which were separated from the forest by the road. If disturbed when foraging in the field, macaques thus had the possibility to quickly seek refuge in the forest, which likely contributed to the relative perceived safety of that area.

Contrary to our predictions, the macaques did not avoid cultivated areas during times of human activity. Agricultural workers, who worked primarily in the orchards, were usually present between 9 am and 6 pm. We expected the macaques to visit crops primarily outside of these hours, either just after dawn or before dusk, as observed in long-tailed macaques (Macaca fascicularis umbrosus; Mishra et al., 2020). This would seem particularly feasible considering that the primary sleeping site of the main focal group, Depog, was near the orchards (Neves et al., 2023a). This pattern of high reuse of the same sleeping site contrasts with those of groups living in sites with no access to human resources, which usually avoid using the same sleeping site on consecutive nights to balance the costs and benefits of predation risk and proximity to food (Albert et al., 2011; Neves et al., 2023a). It is however commonly observed in primate groups which regularly use human resources (Altmann & Muruthi, 1988; Neves et al., 2023a; Strum, 2010) and suggests that macaques in Aïn Leuh might choose to minimize security while maximizing energetic gains (Neves et al., 2023a).

Macaque Responses to Anthropogenic Encounters

Rates of anthropogenic encounters and aggression towards macaques were high in Aïn Leuh, and the macaques’ reactions provided interesting information on their perceptions of risks. Throwing projectiles was effective to induce fleeing reactions, but the macaques also tended to flee when approached by humans who tried to feed them or take pictures. Interestingly, the macaques in Aïn Leuh never accepted food when we observed humans offering it to them, indicating that they do not perceive humans as a potential source of food but rather perceive them as inherently dangerous, even in the absence of overt aggression. Dogs induced fewer fleeing reactions from the macaques, likely because they were unable to reach the macaques when they were in trees. Despite their fear of humans, the macaques fled short distances when receiving aggression from humans and the aggression was not sufficient to drive them out of cultivated areas. While in orchards, the macaques usually moved from tree to tree to avoid humans but did not leave the fruit trees. This suggests that chasing macaques away from the orchards once they have already settled in them is nearly impossible with the tactics currently used by farmers. However, pushing them away towards the forest before they enter seems effective. This tactic was used almost exclusively by guards who were hired to monitor crops in May and early June, before cherry harvesting. For financial reasons, those guards were employed only during this period of cherry maturation, considered by farmers as the most critical. The macaques spent the least time in cultivated areas during this period, which reinforces the conclusion that the guards’ strategy is effective. This strategy consisted of monitoring the forest edges close to the cultivated areas and pushing macaques back to the forest when they approached. These findings align with studies that have shown the effectiveness of systematic crop-guarding against crop-foraging primates in other areas (Hill & Wallace, 2012; Koirala et al., 2021; Mekonnen et al., 2020). However, during the 6 months of observation in Aïn Leuh, we only observed continuous crop-guarding by employed guards for 1 month, whereas in the remaining 5 months, farmers sporadically attempted to chase monkeys away from small areas surrounding their houses. The high use of cultivated areas by Barbary macaques in the absence of guards supports the conclusion that guarding by farmers who are distracted by other tasks is not as successful as continuous monitoring by employed guards (Hill & Wallace, 2012). Although the financial implications must be considered, crop-guarding appears to be a suitable approach for Barbary macaques.

It is crucial to consider the potential negative impacts of violent methods used by guards. The use of slingshots to throw rocks at the macaques can result in serious injuries if the macaques are hit. Living in such a conflicted and stressful environment can have significant implications for the demography of macaque groups. In the case of Depog group, many individuals disappeared during our study, particularly adult females, resulting in a mortality of 37%, in contrast to the <3% mortality observed in forest sites with low human pressure (Neves et al., 2023b). We therefore recommend throwing projectiles near the macaques, not directly at them to ensure safety while maintaining levels of intimidation. Crop-foraging deterrence should be viewed through the lens of optimal foraging theory, i.e., as a balance of costs and benefits (Hill, 2017). To be effective, deterrence must increase the costs or decrease the benefits of crop-foraging compared with natural foraging (Strum, 2010). When endangered and protected species, such as Barbary macaques, are concerned, increasing the costs can only go so far without threatening the survival of individuals and populations. Therefore, efforts should be put towards increasing the benefits of natural foraging, which requires changing current strategies of Barbary macaque habitat management, namely decreasing grazing and logging pressure and favoring more productive natural habitats.

Conclusions

There is an urgent need to develop safe and effective methods to deter Barbary macaques from crop-foraging while maintaining close collaboration with local farmer associations and official institutions. Prioritizing the conservation of this endangered species while addressing the concerns of local farmers is crucial and requires effective crop-foraging deterrents, which do not jeopardize the macaques’ survival. We showed that despite frequent aggressive encounters with humans and dogs, Barbary macaques do not avoid the riskiest habitats and are able to use crops extensively. Trying to chase them away after they have settled inside the orchards is unlikely to succeed, whereas monitoring the crops’ edges and pushing them away before they enter is much more effective. Those insights into Barbary macaque behavioral responses to conflicts with humans and crop-foraging deterrence are important for the development of effective crop-protection methods and ultimately for human-Barbary macaque coexistence. Future research will include interdisciplinary analyses involving both ecological and socioeconomical models, which are expected to result in a range of potential deterrents to be tested on Barbary macaques in Aïn Leuh. In the broader global context of increasing land-use change and human-wildlife conflicts, research of this nature holds significant importance.