## Main

Livestock-derived food products constitute about 35% of the agricultural gross domestic product (GDP) in north sub-Saharan Africa (NSSA)1,2 and support the food security and livelihood of millions of people3. Within the livestock sector, dairy farming, which contributes 28% to the livestock sector GDP (ranging from 12% in West Africa to 45% in East Africa)4, is a promising livelihood option for poor households in NSSA. Moreover, dairy products contribute to food security of many communities in the arid and semi-arid lands by supplying essential nutrients5, and provide 5% of the total energy requirements of households in NSSA6. The majority of milk production in SSA occurs in NSSA (86% of total SSA milk production in 2019–2020), where the production has increased substantially over the past four decades (by 3.3% per year, reaching 30 Mt, with 65% of the total milk production coming from cattle, 25% from small ruminants and 10% from camels)6. This production increase is largely driven by increased livestock population rather than increased livestock productivity. Demand for milk has increased by 4.0% per annum in the last decades, pushed by both human population growth (of 2.8% per annum) and changes in per-capita consumption (0.8% per annum)7. Demand for dairy products is projected to triple by 2050 relative to the consumption levels of 20008. Most of the supply (90%) comes from traditional mixed crop–livestock and extensive pastoral systems9. However, the ability of these systems to sustainably produce sufficient milk to meet these demands is increasingly being challenged by the impacts of climate-related stressors on feed production, water access, heat stress and disease risks10,11.

The climate in NSSA has already changed during the past several decades and is expected to continue to change12,13,14,15,16,17,18,19,20,21,22. Such changes are expected to affect livestock feed availability23,24, water resource availability16,25 and thermal comfort26,27 in many of the drylands in NSSA. Analysis of historical (1981–2010) and future climate projections (2021–2050 and 2071–2100), for example, shows that 11–15% of current milk production in the East Africa occurs in areas where the frequency of detrimental heat stress events are expected to increase significantly (P ≤ 0.05) by 2071–210027.

Given the likely impacts of climate change on livestock systems, and the fact that pastoralist societies in the region are among the most vulnerable groups in the world28,29, a key question regarding sustainable milk production is whether current livestock systems are appropriate for dealing with future environmental challenges. When considering adaptation options, it is necessary also to take environmental impacts into account because dairy farming in SSA already maintains the highest greenhouse gas (GHG) emissions per kg of fat and protein corrected milk (FPCM) in comparison to other parts of the world (7.5 CO2 equivalent (CO2e) per kg FPCM versus a global average of 2.4)30. There have been multiple reports documenting where pastoralist communities in drylands of NSSA (for example, Wodaâbe in Niger, Massaï in Kenya, Borana in Ethiopia, Nuer in South Sudan, and Fulani in West Africa) have adjusted their livestock composition in response to environmental extremes and changing ecological conditions, mostly by shifts from cattle to small ruminants (mainly goat) and/or camels31,32,33,34. Browsers (that is, camels and goats) in some pastoralist communities are preferred over grazers (that is, cattle) due to their greater climate resilience, resulting from their higher tolerance to drought and feed scarcity, as well as their capacity to produce milk and meat in all seasons33,35,36,37,38. The shifting preference for browsers (that is, favouring camels and goats over cattle) due to recent climate variability/change, and associated feed and water shortage was confirmed by over 71.5% of the interviewed households from a survey of the Borana community from Isiolo County, northern Kenya39.

Whereas different livestock species have different climate resilience and tolerances40,41,42,43,44,45,46, location-specific data are required to assess where shifts in herd composition from currently cattle-dominated systems are needed to maintain or even increase dairy production in semi-arid and arid systems under climate change. Therefore, the aims of this study are (1) to assess where in the drylands of NSSA these shifts in herd composition are most likely to occur as an adaptive response to changes in climatic and biophysical conditions, and (2) to determine the possible impact of shifting dairy production from cattle to more climate-resilient goats and camels, in terms of aggregate milk production and environmental sustainability.

## Results

### Spatial and temporal distribution of environmental changes driving shifts in herd composition

For the current study, the annual dry matter biomass production (DMP; Modelling DMP), water accessibility (using the water accessibility index (WAI); Modelling WAI in the Methods) and heat stress (HS) frequency (Modelling HS frequency) were assessed for the period 2001–2020 using long-term climate and remotely sensed data for dryland NSSA (Datasets used in the Methods). Fig. 1 shows the simulated long-term averages of the three components and their regional trends over the 2001–2020 period.

The long-term average annual DMP in the study area was 30 t ha−1 yr−1, ranging from almost zero in more arid lands of the north to 53 t ha−1 yr−1in the southern parts of NSSA. Trend analysis (Statistical test) showed that, apart from the greening zone in the Sahel47 (19% of the study area), there were significant decreasing trends (P ≤ 0.05) in DMP observed in 9% of the study area.

The annual WAI follows a different pattern and is related to the presence of water bodies, with an average of 0.04 for the whole region. Areas with low (0–0.2) and high (0.8–1) WAI cover 80% and 3% of the study area, respectively (Fig. 1b). The results showed a significant decreasing trend (P ≤ 0.05) in WAI in 15% of the study area. However, it should be noted that our WAI does not account for the presence of wells and groundwater resources due to lack of data and because surface water represents the dominant water source for livestock in NSSA.

The average frequency of detrimental HS events for milk production during 2001–2020 was estimated at 77 days per year (21% of the year), and was more frequent in coastal areas of the Greater Horn region, where it exceeds 50% of the days in a given year. Figure 1 also shows that over the past two decades, the frequency of HS events detrimental to milk production has significantly increased (P ≤ 0.05) in 38% of the study area.

We used the criteria explained in Data analysis to assess where the changes in the aforementioned indicators of DMP, WAI and HS have significantly worsened the climatic and biophysical conditions for milk production from cattle in the Sahel and Greater Horn study area. Our results indicate that conditions have recently worsened in 17% of the study area (1.7 million km2) due to changes in environmental conditions (Fig. 2). The affected area is home to 14.2 million cattle, 18.11 million goats and 2.99 million camels.

To provide corroboration and documentation of shifts in herd composition in the region, we conducted a comprehensive review of case studies for areas where pastoralists have already begun shifting from cattle to goats and camels to sustain their livelihood activities amid changing environmental conditions (case studies areas shown by dashed boxes in Fig. 2). We found ten cases in dryland NSSA where the transition from cattle to goats and camels is already evident (East Pokot and Isiolo County in Kenya; Ngorongoro in Tanzania; Afar, Yabelo, Moyale and Jijiga in Ethiopia; Somaliland in Somalia; Misseriyya pastoralists in Sudan; Kaduna and Kano States in Nigeria) and these overlap with our identified areas of deteriorating conditions. On average, according to the Gridded Livestock of the World, v.3 (GLW3), dairy livestock species composition in these areas consisted of 41% cattle, 50% goat and 9% camel in 2010 (for detailed information on dairy livestock species composition in each subregion, see Supplementary Table 1).

### Consequences of shifting herd composition in areas with expected environmental challenges

We modelled the impact of shifting livestock species composition on aggregate milk production and water/feed consumption of all dairy livestock across dryland NSSA. Furthermore, we assessed environmental impacts of shifts in herd composition across all species in the region. We prioritized milk production, followed by water/feed consumption and finally GHG emissions to identify the ‘ideal’ herd composition with the following features: (1) maximum productivity in terms of aggregate milk production, (2) lowest feed/water consumption and (3) lowest ruminant GHG emission across all three species in the entire study area. We also tested three extreme scenarios of shifting herd composition by considering the maximum possible reduction of cattle population in favour of camels and/or goats. We assumed that for arid regions all cattle may be replaced by camels and/or goats, while for semi-arid regions only half of the cattle population may be replaced. The latter scenarios were conducted to assess trade-offs among different possible herd compositions in the region.

Results shown in Fig. 3 demonstrate that, overall, decreasing cattle population by 24% and increasing goat and camel population by 14 and 10%, respectively, resulted in an ideal herd composition across all metrics assessed. Reducing the current cattle population by 5.9 million and increasing goat and camel populations by 7.7 million and 1.2 million, respectively, not only achieves a slight increase in aggregate milk production (+0.14 Mt), but also results in an effective reduction in water (−1,683.6 million m3) and feed consumption (−404.3 Mt), and GHG emissions (−1,224.6 MtCO2e). In addition to ‘idealized’ scenarios where outcomes were optimized for both milk production and environmental benefits, we ran three ‘extreme’ scenarios that did not optimize based on all metrics. For these scenarios, we assumed that the shift from cattle occurred at the maximum possible rate (that is, 100% to camel, 100% to goat, 50% to camel/50% to goat), as shown in Fig. 3. The three ‘extreme’ scenarios resulted in reduced benefits compared with the ‘idealized’ scenarios where all metrics were considered (for detailed results for each subregion, see Supplementary Table 1). For example, in case of the 100% to goat scenario, although replacing 100% of cattle with goats has advantages in terms of feed usage (−15%), water consumption (−33%) and GHG emission (−9%), milk production in this scenario would drop by 26%.

## Discussion

Environmental changes have already undermined food security in cattle-dominated systems in dryland NSSA48,49,50. In general, this could be dealt with by reducing the number of cattle in areas where challenges are expected. Reductions in cattle could be accomplished either by shifting towards other, non-meat-based diets, or by shifting toward other livestock species, which could improve both food security and reduce emissions at the regional level. However, although reducing animal-sourced proteins has been shown to be important in improving diet and reducing emissions from intensive livestock systems in the Global North51, such reductions in NSSA and developing countries more generally need to be weighed against the critical role that animal proteins play in nutrition, particularly in pastoralist and agropastoral communities where undernutrition and malnutrition are common52. Therefore, achieving these goals through reduced consumption of animal-sourced protein is not appropriate in many parts of dryland NSSA53. A more viable option in these areas would be to change herd composition in favour of species that perform better under harsh environmental conditions (that is, camel and goat)54, while devoting more research to these issues. To fill the current knowledge gaps associated with simultaneous changes in climate and feed and water resource availability, this study uses the most reliable datasets available to demonstrate where in the study region shifts in herd composition are likely to be more pronounced (based on climatic and biophysical conditions), and to what extent switching from grazing- to browsing-dominated livestock may be beneficial in terms of milk production, water and feed consumption, and GHG emissions. Based on our results, milk production from cattle is expected to become more challenging in approximately one-fifth of the region due to changes in DMP, WAI and HS. The results of optimizing the herd composition in these regions indicate that shifting dairy production toward climate-resilient species (that is, goats and camels) may represent a ‘win–win’ scenario for dryland NSSA that not only increases aggregate milk production, but also decreases the environmental footprint of milk production in terms of water use, feed consumption and GHG emissions at the regional scale.

Although we tried to comprehensively cover possible drivers, there may be other potential drivers such as changes in woody cover and groundwater level affecting herd composition for which there is limited data and process understanding at present. Based on available information about changes in woody cover derived from satellite passive microwave observations55, there has been an increasing trend in woody cover in 46.5% of areas where challenges are expected (in 38% and 55% of subregions located in arid and semi-arid climate zones by 0–5% (on average +0.47%) and 0–14% (on average +0.51%), respectively) between 1992 and 2011. Although we did not consider this as a potential driving factor for shifts in herd composition due to the lack of spatially explicit data on changes in woody vegetation, the results reported here support the hypothesis that shifting dairy production to camels and goats may be more compatible with increases in woody vegetation56. With regard to groundwater as another source for watering of livestock, checking the output of the WaterGAP v.2.2d model for groundwater level changes during 2001–201657 reveals that, for the majority of the areas where challenges are expected (90%), no significant changes (P ≤ 0.05) were reported, while the trend was significantly (P ≤ 0.05) increasing or decreasing in 8% and 2% of the region, respectively. Nevertheless, there is little to no reliable, comprehensive data on how much groundwater is used for the livestock sector, and how infrastructure for groundwater supply has changed in the last several decades58,59.

In this study, it was assumed that energy values for milk across species were similar (262, 270 and 259 kJ per 100 g of milk for cattle, goat and camel, respectively5). However, other studies have shown that the chemical composition of milk (that is, fat, protein, ash, vitamins, etc.) from livestock differs between species60,61,62,63,64,65 depending on feeding practice, breed differences, lactation stage, management, analytical procedures, etc.66,67,68,69. In general, camel milk is known for having lower saturated fat and lactose, and higher minerals and vitamins (especially vitamin C and B vitamins) compared with cattle milk70.

Although our study focuses on the dairy sector, it is important to note that these recommendations may also affect other roles livestock plays in rural communities. This is specifically true for the meat sector, where according to a recent study for the post-2020 period, the percentage share of beef supplied by the dairy sector in SSA is required to increase by 8% (from 69% to 77%)71 to meet overall demand for non-dairy animal proteins. In this way, both camel and goat, known as adapted multipurpose animals, could potentially play vital roles as meat protein sources. According to the FAO statistics for 2020, cattle, small ruminants and camels contributed 36%, 12% and 3% to total meat production in NSSA, respectively. It is notable that the growth rate of camel and goat meat production in NSSA was higher than for cattle (camel, +4.7% yr−1; goat, +3.8% yr−1; cattle, +2.5% yr−1)6. Camel meat is nutritionally comparable to beef, with lower intramuscular fat and cholesterol content, and higher iron content72.

A shift from grazers to browsers might also affect other ecosystem services. Some research indicates that long-term browsing by livestock (that is, camels and goats) and wildlife species in dryland ecosystems may support more diverse vegetation in general and a higher proportion of pasture grasses available for grazing livestock specifically73. Thus, it may also be profitable for people in areas that are currently not projected to be negatively affected by changes in environmental conditions to increase their livestock diversity to strengthen their resilience against climate extremes.

Additionally, there are economic advantages from multispecies pastoralism because income diversification allows herders to better cope with economic, political and ecological instabilities. In some case studies, for example, it was shown that many households in the three most important Ethiopian pastoralist communities (the Afar in the northeast, the Borana in the south and the Somali in the east and southeast) have already diversified their income sources from livestock, to the extent that there are differences in household income depending on the extent of their engagement in multispecies herding38,74. Marketing and customer preferences for different goat and camel products vary greatly from one region to another, between rural and urban communities with different socioeconomic standards, and between different ethnic groups, and are changing over time. While in some regions milk production is of outstanding economic importance due to growing customer demand, in other regions meat production is the main revenue for livestock producers. For example, in Samburu County, Kenya, where camel rearing was not common historically, it has been reported that currently households prefer camel milk to other types of milk75. In the last decade, the market for goat and camel products has also substantially expanded in NSSA with increased demand and growing awareness of the health benefits of these products (specifically in the case of camel milk/meat)76. For instance, rapid growth in the demand for camel milk and the camel milk value chain has been reported in Somalia77. Nevertheless, there are still economic barriers to shifting from dairy cattle to goat or camel, particularly because female camels are more expensive than dairy cattle. For example, in Kenyan livestock markets in 2021, one camel cost US\$421–526, which was equivalent to 2–3 cattle or 10 goats78. Another barrier to adoption of goats and camels is lack of knowledge and skills related to animal husbandry and management practices, and the start-up costs of purchasing additional equipment and technologies needed for goat and camel production. For instance, when shifting from cattle to camel, although a mature camel may offer a higher rate of economic return than cattle and goats (depending on farm type, livestock breed, feeding situation, location, etc.), camels may have financial drawbacks due to their lower reproductive rate compared with other species, which is due to their relatively late puberty (3 yr) and longer calving interval (2 yr).

Although adapting milk production systems by changing the herd composition holds promise as an effective adaptation strategy against climate change while also creating environmental benefits, there are multiple challenges that must be overcome to facilitate uptake of these adaptation practices among livestock keepers in the region. Importantly, there should be a clearer policy framework in place to effectively support pastoralists and other livestock keepers through the development of the goat and camel dairy sectors at various scales (national, regional and international). Since our current knowledge of goat and camel production systems at local to regional scales remains insufficient compared with dairy cattle production in NSSA, livestock value chain actors and research organizations should employ a multisectoral approach that prioritizes future research on breeding, disease control and nutrition services for these species. For instance, future breeding should emphasize both heat-tolerant cattle breeds and increasing goat/camel milk yields. Finally, improvements in goat and camel dairy supply chains—such as processing technologies to improve dairy goat and camel product markets, facilities to transport milk to local markets79,80, and distribution and processing infrastructure for output markets—are essential for harnessing the full potential of shifts in herd composition and realizing the vision of sustainable and food-secure dairy production in NSSA by 2030.

## Methods

### Study area

The study area for the current research comprised arid and semi-arid zones81 in the Sudano-Sahel and Greater Horn of African regions of NSSA (defined in this study as 5°–20° N, 20° W–55° E) covering an area of 10 million km2. Supplementary Fig. 1 shows the average climate conditions for the study area. According to the GPWv4, the human population in the study area in 2010 was estimated to be around 256 million inhabitants82, mostly dependent on crop farming and livestock-husbandry activities for their livelihoods83. According to the GLW3 database, the total populations of cattle, goats and camels in the region were approximately 78, 105 and 14 million, respectively84.

### Datasets used

#### Climate dataset

The climatic data required for this analysis, that is, air temperature (°C) and the relative humidity (%) (Modelling HS frequency), were obtained from the European Centre for Medium-Range Weather Forecasts (ECMWF) Reanalysis v.5—Land (ERA5-Land) database85,86.

#### Livestock population dataset

The total number of livestock in the study area have been extracted from the GLW3 database84. This dataset is a snapshot of the total number of cattle and goats per pixel for the year 2010. Furthermore, in this study the camel density map includes dromedary and Bactrian camel distribution, and is an unpublished model based on the methodology described in Robinson et al.87 (Supplementary Fig. 2).

#### Livestock milk supply and demand

To estimate supply and demand for milk, a global dataset provided by the FAO Global Perspective Studies Unit88 was used. The dataset includes estimates of milk consumption, production, import and export, in 2000 and 2030, and their absolute and proportional changes (with a resolution of 0.05°).

#### Length of growing period

A dataset for the start and the end of the growing season, based on Normalized Difference Vegetation Index (NDVI) time series89, was used for quantifying the DMP from remote sensing data (Modelling DMP).

#### Remote sensing data

The satellite products used in this study were acquired successively from the VEGETATION sensor of the SPOT4 and SPOT5 (Satellite Pour l’Observation de la Terre) and PROBA-V (Project for On-Board Autonomy–Vegetation) satellites via the Copernicus Global Land Service (CGLS) platform. The different products are:

• DMP (kg ha−1 d−1) represents the overall growth rate or dry biomass increase of the vegetation and is directly related to ecosystem net primary productivity. This is retrieved using Monteith’s90 model to calculate the instantaneous daily DMP (kg ha−1 d−1), as follows:

DMP = RG × εi × εc × εb × 10,000

where RG = the incident solar radiation at the Earth’s surface (J m−2 d−1); εi = the fraction of absorbed photosynthetically active radiation (fAPAR) or the interception efficiency of the vegetation calculated as εi = fAPAR = A + B × NDVI (ref. 91), where A and B = sensor heuristic calibration92; εc = the fraction of photosynthetically active radiation of the incident solar radiation (here, 0.48); εb = the conversion efficiency of PAR to vegetation productivity, as a function of temperature93. The version used is DMP 1 km V1, which is specifically produced by the Flemish Institute for Technological Research (VITO) using an initial DMP algorithm94 that offers better performance over semi-arid areas of low vegetation production.

• NDVI v.1, 1 km.

• Small Water Bodies (SWB) provides Boolean information on the presence of surface water95. The version used is 1 km Africa V1.

All datasets were used with temporal extent from April 1998 to January 2021 and with 10 day frequency.

### Modelling climatic and biophysical properties

Herd composition is often constrained by a variety of contextual variables ranging from climatic and biophysical properties to levels of economic, social and infrastructural development. From the climatic and biophysical point of view, previous studies showed that feed and water shortage, and the occurrence and severity of climate extremes, are among the most important driving forces that could potentially lead to changes in herd composition in the study area23,34,39,96,97,98,99. In the following the procedure for modelling each of these factors during the period 2001–2020 is described.

#### Modelling DMP

In this study, the annual DMP, expressed as the cumulative total dry matter biomass produced over the growing season, was quantified by a validated tool, BioGenerator v.5.1100. This tool uses as main input the decadal DMP on which it operates cumulatively throughout the growing season.

$${{{\mathrm{DMP}}}}_y = \frac{{{{{\mathrm{365}}}}{{{\mathrm{.25}}}}}}{{{{{\mathrm{36}}}}}} \times \mathop {\sum }\limits_{{{d = }}d_{\mathrm{i}}}^{d_{\mathrm{f}}} {{{\mathrm{DMP}}}}_{{{y,d}}}$$

where y is the considered year, and di and df are respectively the first decade and the last decade of cumulation. di and df have to be set to include the total vegetation annual peak of production with the constraint that the di needs to be set to be before the start of the season but after the end of the season of the previous year, and conversely for df. An analysis of study results on the growing period over Africa89 permitted a satisfactory compromise that resulted in valid constant values over the whole study window: di = second decade of February and df = first decade of February of the following year (y + 1).

Before cumulating, the DMP is temporally filtered using NDVI to remove noise and residual clouds. Filtering functions, based on best index slope extraction and a low-pass filter, are described in detail in the BioGenerator technical document100.

#### Modelling WAI

Surface water accessibility was characterized using the HydroGenerator v.4.3 tool100. HydroGenerator uses the SWB product delivered by CGLS as its main input. HydroGenerator applies a 30 km buffer ring around the detected cells, which are ranked with a decreasing Gaussian weighting function of distance to the point, called the WAI, as follows:

$${{{\mathrm{WAI}}}}\left( d \right) = \left( {{{{\mathrm{1 - }}}}F_{{{{\mathrm{BG}}}}}} \right) \times e^{ - \frac{{d^2}}{{{{{\mathrm{2}}}} \times \sigma ^2}}} + F_{{{{\mathrm{BG}}}}}$$

where d is the distance to the water point (km); σ is a parameter of the Gaussian set to reach 1% beyond 30 km ($$\sigma = \frac{{{{{\mathrm{30}}}}}}{{\sqrt {2{{{\mathrm{ln100}}}}} }}$$); and FBG is the background WAI depending on aridity zones101 (progressive evolution from hyper-arid = 0% to humid = 100%). The WAI ranges from 0 to 1, with 0 representing no access to a water point and 1 representing the position of a permanent water point.

#### Modelling HS frequency

In this research we assessed the thermal HS conditions for dairy cattle by using the temperature–humidity index (THI). For this purpose, first, the daily THI values were calculated based on formula developed by the National Research Council102 and classified using the THI threshold for dairy cattle103:

$${\mathrm{Daily}}\,{\rm{THI}} = \left( {1.8 \times T_{\mathrm{db}} + 32} \right) - \left[ {\left( {0.55 - 0.0055 \times {\mathrm{RH}}} \right) \times \left( {1.8 \times T_{\mathrm{db}} - 26.8} \right)} \right]$$

where Tdb is the dry-bulb temperature (°C) (the daily maximum temperature was used instead of Tdb in this case, following previous research27); and RH is the relative humidity (%).

Then, the percentage of occurrence of detrimental HS days (that is, events which result in substantial changes in milk production; above moderate and severe/danger thresholds) over a year was calculated for each grid point and for the entire period (2001–2020) and used as a measure for the thermal (dis)comfort27.

### Statistical test

The non-parametric Mann–Kendall trend test104,105 (H0, there is no trend; H1, there exists a downward or upward trend over time) and Sen’s slope estimator106 were used for detection of trends and the slopes of the trend in the time series (2001–2020) of DMP, HS and WAI at the 5% and 1% significance levels.

### Data analysis

After preparing the DMP, HS and WAI time series for each grid point (0.1° × 0.1°), a stepwise procedure was followed to answer the defined listed research questions.

Step 1: where in the study area is the cattle production likely to be affected most?

Four separate criteria were used to identify where in the study area conditions have become significantly worse for cattle production:

1. (1)

If all the three factors significantly changed at the 5% significance level: HS, increasing; DMP, decreasing; WAI, decreasing.

2. (2)

If the DMP significantly changed at the 1% significance level and if the quotient (DMP 2011–2020)/(DMP 2001–2010) was <0.5.

3. (3)

If the HS significantly changed at the 1% significance level and the quotient of (HS 2011–2020)/(HS 2001–2010) was >10%.

4. (4)

If the WAI significantly changed at the 1% significance level and the quotient (WAI 2011–2020)/(WAI 2001–2010) was <0.5.

Step 2: what is the current livestock population composition in regions where the criterion explained in step 1 has been satisfied (percentage of cattle, goats and camel)? What is the average milk supply and demand in these regions?

Extract total livestock numbers (Livestock population dataset) and milk production and demand (Livestock milk supply and demand) in each of the grid cells where conditions have become significantly worse for cattle production. These data where used to calculate the average herd composition, in terms of percentage of cattle, goat and camels, and average milk supply and demand.

Step 3: what is the relationship between milk production and herd composition in regions where the criterion explained in step 1 has been satisfied?

To establish how much of the milk production is coming from each species, N equations with three unknowns were solved simultaneously; Ax + By + Cz = milk production of the grid point; x, y, z = the numbers of cattle, goats and camels, respectively; A, B, C = milk production of cattle, goats and camels, respectively.

After fitting the distribution function to the A, B and C values, the average values have been used as the ideal herd composition for the remainder of the analysis (cattle = 171, goat = 68, camel = 295) (Supplementary Fig. 3).

Step 4: how much feed and water are needed to produce 1 kg of milk? What are the GHG emissions associated with 1 kg of milk from cattle, goats and camels?

We conducted a literature review to determine the water usage, feed consumption and GHG emissions associated with the production of 1 kg of milk from cattle, goats and camels. The values reported from previous research on the water and feed usage for 1 kg of milk from cattle, goats and camels and their GHG emissions, mostly for arid and semi-arid regions of SSA, are shown in Supplementary Figs. 4–6. In this study, the average values have been used for the rest of the analysis, wherein kg feed DM per kg milk from cattle = 1.78, goat = 1.43, camel = 1.17; litres of water per kg milk from cattle = 5.73, goat = 2.73, camel = 4.90; kgCO2e per kg milk from cattle = 7.25, goat = 6.70, camel = 6.00. Estimates of GHGs emitted to produce 1 kg of milk are based on published studies on CH4 emissions from enteric fermentation and both CH4 and N2O emissions from livestock manure management under extensive and mixed farming systems in dryland NSSA (see Supplementary Figs. 4–6 for references to these studies).

Step 5: what happens if we shift from cattle toward goats or camels in regions where the criterion explained in step 1 has been satisfied? What is the ideal scenario, that is, where the quantity of milk be produced is the same or increased, but with less water/feed consumption and GHG emissions (for each subregion and as an average)?

Here, we changed the herd composition towards having fewer cattle such that the total tropical livestock unit (TLU, 1 TLU = 250 kg bodyweight) was constant. In this step, each time after the herd composition was changed, values from steps 3 and 4 were used to assess outcomes in terms of milk production, water/feed usage and GHG emissions. The first priority of the objective function was to maximize milk production (herd compositions with milk production more than the 75th percentile of all combinations). The second objective was to minimize the water/feed usage and finally to have lower GHG emissions (herd compositions with water/feed usage and GHG emissions less than the 25th percentile of all combinations). Pastoralists in arid areas may have lower general adaptive capacity due to lack of alternative livelihood opportunities, but may be more open to shifts in herd composition due to existing familiarity with multiple livestock species107. On the other hand, mixed farming systems in semi-arid areas will probably have less incentive to change their herd composition due to less familiarity with mixed herds and possessing greater assets compared with pastoralists108. Therefore, it was assumed that mixed systems would be more limited with respect to maximum potential reductions in cattle compared with more arid regions, where pastoralist systems predominate, and may be able to sustain larger maximum proportional reductions in cattle populations. To this end, when shifting from cattle to goats and camels in mixed crop–livestock systems, we did not allow the proportional change in cattle in these systems for a given grid point to exceed half of current cattle population (Supplementary Table 1).

Step 6: what is the expected aggregate milk production for the ideal herd composition at the regional scale, and the feed and water requirements and GHG emissions associated with this level of milk production? How can shifts in herd composition contribute to closing the gap in projected milk demand for 2030?

### Reporting summary

Further information on research design is available in the Nature Research Reporting Summary linked to this article.