1 Introduction

Nitrogen (N) is a crucial agricultural input and a yield-limiting nutrient in agricultural production. Since the Haber-Bosch process was discovered in the early 20th century for artificially fixing atmospheric N (N2), the production of synthetic N fertilizer (SNF) has converted a substantial amount of unreactive N to reactive N forms, allowing farmers to convert infertile land to fertile land (Galloway et al. 2004). With a growing human population, the increasing demand for agricultural products requires properly managing agricultural systems with a sufficient supply of vital crop nutrients, particularly N (Ladha et al. 2016; Gerten et al. 2020). Insufficient reactive N input to agricultural soil reduces crop yield and depletes soil N reserves; on the other hand, a high supply of reactive N to cropland combined with low N use efficiency (NUE) can result in N loss, posing environmental problems (Hutchings et al. 2020; Quan et al. 2021b, a; Raza et al. 2022). With an increased demand for feed, fuel, fiber, and food, the agricultural sector should produce substantial quantities of agro-products without compromising the environment and natural landscape wellness (Gerten et al. 2020; Hutchings et al. 2020; Chen et al. 2021). Therefore, a pressing need exists to minimize SNF and promote more environmentally friendly agricultural practices.

Over the last few decades, there have been large differences in fertilizer usage between richer and poorer countries (Motesharezadeh et al. 2017; He et al. 2021). Globally, total N input from SNF, animal N manure (ANM), and biological N fixation (BNF) used for agricultural production increased about two-fold from 92 Tg N yr-1 (1970) to 165 Tg N yr-1 (1995) and is projected to reach 214 Tg N yr-1 by 2030 (Eickhout et al. 2006). In Africa, the estimated amount proportion of N derived from SNF grew from 0.45 Tg N yr-1 (1961-1965) to 3.6 Tg N yr-1 (2010-2017), whereas the estimated amount of N from ANM and BNF increased from 1.1 Tg N yr-1 to 3.7 Tg N yr-1 (Elrys et al. 2021), indicating that crop production in Africa is primarily dependent on ANM and BNF (Elrys et al. 2019a). N inputs during crop production are expected to keep rising in low- and medium-income countries and high-income countries (Eickhout et al. 2006). Some low- and medium-income countries, such as Egypt, Pakistan, and China, are using SNF more than high-income countries (Elrys et al. 2019a; Raza et al. 2022). However, they face serious soil and environmental problems (Evenson and Gollin 2003; Xu et al. 2014). In contrast, a lack of SNF in low-income African countries, notably in Sub-Saharan Africa, prevents them from producing enough crop yields to support an expanding population, leading to soil N stock mining and depletion (Davidson 2009; Zhou et al. 2014; Harerimana et al. 2021).

Current agricultural practices focus on increasing yields in the near term rather than restoring soil nutrient stocks and increasing input efficiency (He et al. 2021; Leip et al. 2021). However, they face two main challenges: boosting agricultural food production while minimizing the environmental pollution (Muller et al. 2017; Chen et al. 2021). To resolve these issues, the agricultural system's N budget was established (Oenema et al. 2003; Häußermann et al. 2020). When taking actions to use N and protect the environment efficiently, awareness of the N budget is essential. So far, N budgets have been completed on a global scale (Fowler et al. 2013; Billen et al. 2014; Lassaletta et al. 2014; Ladha et al. 2016; Zhang et al. 2020, 2021), continental scale (Elrys et al. 2019a; Kiboi et al. 2019), regional scale (Masso et al. 2017; Dattamudi et al. 2020), and national scale (Raza et al. 2018; Elrys et al. 2019b; Karimi et al. 2020; Harerimana et al. 2021; Häußermann et al. 2021). The NUE ranged from 60% to more than 100% in low- and medium-income countries, with a N surplus of less than 10 kg N ha-1yr-1. It ranged from 55% to 75% in high-income countries, with N surpluses ranging from 25 kg N ha-1yr-1 to 70 kg N ha-1yr-1. Exceptionally, some low- and medium-income countries, including Bangladesh, China, Egypt, India, Pakistan, and Sri Lanka, had a NUE of less than 35% with a N surplus of more than 100 kg N ha-1yr-1.

Local food production is crucial to the sustainability of African livelihoods. Over the past five decades, there have been changes in land use, crop production, fertilizer use (FAOSTAT 2018), and management. We believe that soil N depletion during agricultural production is decreasing in Africa. Regional estimates of N budget within agricultural systems can provide insight into changes in soil N stock, raise awareness of NUE, and assist in long-term N management. However, only few studies have involved agricultural N budgeting on regional scale in Africa (Robertson and Rosswall 1986; Zhou et al. 2014). Hence, all of these studies suggested fortifying synthetic fertilizer use as a more appropriate practice to sustain agricultural production for a growing population. In response, many Sub-Saharan Africa governments' efforts to address soil fertility issues have emphasized synthetic fertilizer subsidies (Rashid et al. 2013; Sheahan and Barrett 2017; Bonilla Cedrez et al. 2020 et al. 2020). Despite this, in Sub-Saharan Africa, most of the synthetic fertilizers used for farming is imported from abroad (Chianu et al. 2011; Warra and Prasad 2020) and transport costs are very high, inciting farmers to pay up to six times the actual global fertilizer price (Karingi and Mwakubo 2018) while the majority of Sub-Saharan Africa farmers are too poor to afford it (Ndakidemi et al. 2006). In addition, the COVID-19 pandemic has put continuous strain on the global agricultural systems and has worsened poverty in Sub-Saharan Africa (Sihlobo et al. 2021). The World Food Day 2021, with this year's global theme: "Our actions are our future." "Better production, better nutrition, better environment, and better life" calls for the transformation of agricultural systems to ensure that everyone, everywhere, has affordable, sufficient, safe, and nutritious food to live active and healthy lives (FAO 2021). Therefore, an option is to focus more on the effective use of farmer-available input sources to provide plant nutrients as needed (Bekunda et al. 2010; Muller et al. 2017; Barbieri et al. 2021). To achieve long-term human, soil, and environmental health in Sub-Saharan Africa countries, it is crucial to investigate economic N resources.

The East African Community (EAC) is a regional intergovernmental organization signed on 30 November 1999, and entered into force on 7 July 2000 (East African Community 2022). It is currently composed of seven member states, namely Rwanda, Uganda, Tanzania, Burundi, Kenya, the Democratic Republic of the Congo, and South Sudan. The EAC was meant to reactivate and expand on a former organization founded in 1967 by Kenya, Tanzania, and Uganda that collapsed in 1977 owing to political and economic reasons (Bar 2018). Countries came together to boost interactions and transactions and attain higher economic growth rates and development (Ouma 2016). According to the EAC Treaty, food security and sound agricultural production are two of its main goals (East African Community 2021). Thus, agricultural development has been the EAC's primary policy goal since its re-establishment in 2000 (Tondel 2017). The agricultural sector performs poorly due to policy constraints, technological factors, environmental factors, cross-cutting, and cross-sectoral factors (East African Community 2021). Consequently, the EAC is frequently affected by food shortages and pockets of hunger, despite having the potential and capacity to produce enough food for regional consumption and considerable surpluses to export (FAO 2021). Vision 2050 stresses promoting sustainable agricultural systems productivity in the EAC as well (East African Community 2015).

Therefore, there is a need for a more detailed N-cycling study within the EAC to achieve the desired agricultural production systems through the use of accessible, affordable local resources and policies (Fig. 1). The objective of the current study was to assess, for the first time, historical changes in the N budget of agricultural systems in the EAC region from 1961 to 2018 in order to suggest suitable and affordable management practices for restoring and improving soil fertility.

Fig. 1
figure 1

Illustrations of (A) a map of the African continent highlighting the East African Community region and (B) major elements considered when estimating the N flows in the agricultural systems of the East African Community (only countries marked yellow are in the study due to a lack of data for South Sudan and the Democratic Republic of the Congo)

2 Materials and methods

2.1 Study region

The EAC is one of the most successful regional integrations in Africa, and it has a growing economy (Ejones et al. 2021; Lwesya 2022). Its current area is 4.8 million km2 (Table S1), with a population of 300 million (East African Community 2022). States members range from Northern-east Africa (South Sudan), East-central Africa (Rwanda and Burundi), Eastern Africa (Kenya, Uganda, and Tanzania), and Southern-central Africa (Democratic Republic of the Congo) (GeoDatos 2022). The climatic, topographic, and ecological characteristics of countries differ (Table S1).

This study excludes the Democratic Republic of the Congo because it joined the EAC in 2022 (East African Community 2022), and South Sudan because it was formed in 2011 (Kuol 2020), and most data were unavailable. Agronomically, the EAC has changed over the last 58 years (Table 1). From the 1960s to the 2000s, total population, arable, and agricultural areas increased by 234%, 63%, and 23%, respectively, while they increased 30%, 22%, and 7% in the 2010s (Table 1). Over the last five decades, all crops have increased in production areas, except for fruits (Table S2). Crop yields and livestock numbers increased as well, namely for cattle, goats, sheep, poultry, and pigs (Table 1).

Table 1 Agricultural intensification in the East African Community from 1961 to 2018. Source: FAOSTAT 2018

2.2 N budget and N use efficiency estimation approaches

2.2.1 Agricultural system boundaries

We calculated the annual cropland area for each EAC member state for the period 1961-2018 by totaling the areas of all individual crops reported in FAOstat (FAOSTAT 2018). In cases where the total area of all individual crops for a given year exceeds the reported cropland area (arable land and permanent crops) by FAOstat, we have kept the latest area to avoid overestimating the actual area of intercropped crops in the same field (Billen et al. 2014; Lassaletta et al. 2014).

2.2.2 N inputs

Total N input to agricultural systems was calculated by summing N inputs in the form of SNF, ANM, atmospheric N deposition, and BNF.

We collected historical data on SNF use on cropland for each EAC state from 1961 to 2018 from the FAOstat and the IFAstat databases (FAOSTAT 2018; IFASTAT 2018). Historical data on ANM applied to cropland from 1961 to 2018 for each EAC state were accessed from the FAOstat database. We estimated atmospheric N deposition (deposition of oxidized and reduced N compounds) for each EAC state by multiplying the regional estimate of atmospheric N deposition onto cropland reported in Dentener et al. (2006) by the annual cropland area from 1961 to 2018. N input from BNF in agricultural land by N-fixing crops included in the FAOstat database (FAOSTAT 2018) was calculated using a yield-based model, assuming that crop yield is the best aggregator of crop-related variables associated with soil and climatic conditions, such as N availability, soil moisture, stand vigor, and other management factors affecting N2 fixation, as shown in equation (1) (Lassaletta et al. 2014).

$$\mathrm N\;\mathrm{Fixed}=\%\mathrm N\mathrm d\mathrm f\mathrm a\times\frac{\mathrm{Crop}\;\mathrm{yield}}{\mathrm{NHI}}\times\mathrm{BGN}$$
(1)

Where %Ndfa is the percentage of N uptake resulting from N fixation, Crop yield is the crop harvest (kg N ha-1yr-1), NHI is the N harvest index (ratio of N stored in grain over the total amount of grain and straw), BGN is a multiplicative factor that accounts for the proportion of underground N2 fixation to total N2 fixation. For N fixing in soybeans, we used a regional %Ndfa. The values of %Ndfa, NHI and BGN used in this study are presented in Table S3. A constant rate of BNF per hectare was also used for sugarcane and rice paddy, as suggested by Herridge et al. (2008).

2.2.3 N outputs

Total N output of agricultural systems was calculated by adding N removal from cropland through crop N uptake, gaseous emissions (ammonia (NH3) volatilization, nitrous oxide (N2O) emission, and nitric oxide (NO) emission), and hydrous loss.

We calculated the annual N crop uptake for each crop harvested in each EAC state by multiplying its annual yield reported in the FAOstat database (FAOSTAT 2018) by its N content (Lassaletta et al. 2014). The annual total N crop uptake was estimated by adding up the annual N crop uptake for all crops harvested. The application of SNF and ANM to cropland is accompanied by N losses through different pathways. We estimated NH3 volatilization, N2O, and NO emissions based on specific emission factors (Table S4) (Bouwman et al. 2002; FAO 2001). NH3 volatilization emission factors vary with cropland type (upland crops and wetland rice) and N source. To estimate the annual quantity of NH3 gaseous emissions from cropland after fertilizer application, we multiplied regional emission factors reported in Bouwman et al. (2002) by annual input of SNF and ANM. To estimate annual N2O and NO emissions from cropland, we based our estimates on emission factors for developing countries (FAO 2001), multiplying them with annual input of SNF and ANM. We estimated the annual quantity of N loss through leaching from the applied fertilizer by assuming a 10% loss (3% and 7% of applied ANM and SNF, respectively), taking into consideration the low fertilizer uses and the region's highest rainfall (Table S1). The rate at which added fertilizer is leached from the soil may depend on various factors, including rainfall, type of crop, physical and biochemical properties of the soil, management practices, and more (Boumans et al. 2005; Musyoka et al. 2019; Zheng et al. 2019). For this, we based our assumption on the study by Ross et al. (2008), which revealed that the amount of N loss by leaching from the applied N fertilizer may range from 5% to 50%.

2.2.4 Soil N stock

We defined the status of soil N stock as “change in soil N stock” to reflect the amount of N being recharged to soil stock or the depletion of soil N stock after N inputs through SNF, ANM, BNF, and atmospheric N deposition and after N outputs from the soil through crop N uptake, gaseous loss, and N leaching.

2.2.5 N use efficiency and N surplus

According to Raza et al. (2018) and Zhang et al. (2021), we computed NUE and N surplus from 1961 to 2018 using equations (2) and (3), respectively.

$$\mathrm{NUE}(\%)=\frac{\mathrm{Total}\;\mathrm N\;\mathrm{crop}\;\mathrm{uptake}}{\mathrm{Total}\;\mathrm N\;\mathrm{input}}\times100$$
(2)
$$\mathrm N\;\mathrm{surplus}=\mathrm{Total}\;\mathrm N\;\mathrm{input}-\mathrm{Total}\;\mathrm N\;\mathrm{crop}\;\mathrm{uptake}$$
(3)

2.2.6 Classification criteria for N inputs, N outputs, and N surplus

Previous global and continental studies of N use, yield, surplus, and loss have resulted in low rates for East African countries compared to the rest of the world (Billen et al. 2014; Lassaletta et al. 2014; Elrys et al. 2019a). We therefore classified N inputs, N outputs, and N surplus rates in the agricultural systems of the EAC states as extremely low, low, and moderate rates. An extremely low rate refers to SNF, N surplus, and N loss rates of less than 1 kg N ha-1yr-1; BNF and ANM rates of less than 5 kg N ha-1yr-1; total N input and total N crop uptake rates of less than 10 kg N ha-1yr-1. A low rate refers to SNF and N surplus rates of 1 to 10 kg N ha-1yr-1; BNF and ANM rates of 5 to 10 kg N ha-1yr-1; total N input and total N crop uptake rates of 10 to 20 kg N ha-1yr-1; N loss rate of 1 to 5 kg N ha-1yr-1. A moderate rate refers to SNF, BNF, ANM, and N surplus rates of more than 10 kg N ha-1yr-1; total N input and total N crop uptake rates of more than 20 kg N ha-1yr-1; N loss rate of more than 5 kg N ha-1yr-1.

2.2.7 Comparison with other regions

We compared the agricultural systems of the EAC region and global regions in 2009. The data source for other regions was collected from Billen et al. (2014).

2.2.8 Uncertainty analysis

Input parameter sensitivity analyses were conducted using Monte Carlo simulations to shed some light on the uncertainties in the calculations of N surplus, soil N stock, and NUE. The Monte Carlo approach assumes that the distribution functions of the input parameters may quantify their uncertainty (Ti et al. 2011). We used Microsoft Excel embedded with Crystal Ball to develop the output parameter estimation formulations. A Monte Carlo simulation with 10,000 iterations was then run to obtain the means at 95% confidence intervals for the 1960s period (from 1961 to 1970), the 2000s period (from 2001 to 2010), and the 2010s period (from 2011 to 2018) simultaneously to quantify the overall uncertainty in the N surplus, soil N stock, and NUE estimations. When running the Monte Carlo simulation, we assumed that all of the model parameters had a normal distribution with mean values and standard deviations.

3 Results and discussion

3.1 Regional N inputs and outputs of agricultural systems

Total N input to agricultural lands in the EAC almost doubled since the 1960s at 12.5 kg N ha-1yr- 1, increased to 21.6 kg N ha-1yr-1 in the 2000s and 27 kg N ha-1yr- 1 in the 2010s (Table 2). Simultaneously, the arable land increased from 14.34×106 ha to 23.31×106 ha and 28.39×106 ha (Table 1). In the all-input contributors, SNF presented the highest increase from 1.1 kg N ha-1yr-1 (1960s) to 4.9 kg N ha-1yr-1 (2000s) and 7.7 kg N ha-1yr-1 (2010s) (Fig. 2A and Table 2). We recently noticed low SNF rates in most EAC states of less than 10 kg N ha-1yr-1, except in Kenya, where the rate was about twenty-fold that of some countries in the region (Table 2). The BNF increased from 3.1 kg N ha-1yr-1 (1960s) to 5.4 kg N ha-1yr-1 (2000s) and 7.3 kg N ha-1yr-1 (2010s) (Fig. 2A and Table 2). From the 1960s to 2000s, the N input derived from ANM has increased 1.9-fold (from 3.5 to 6.7 kg N ha-1yr-1); later, during the 2010s, it increased up to 7.4 kg N ha-1yr-1 (Table 2). Recently, Rwanda had a moderate BNF while Uganda had an extremely low BNF (Table 2). Other states experienced an increase in BNF from extremely low levels to low over the past five decades (Table 2).

Table 2 Mean N inputs to cropland, total N crop uptake, N use efficiency, N surplus, and N loss in the agricultural systems of the East African Community states in the 1960s (from 1961 to 1970), 2000s (from 2001 to 2010) and 2010s (from 2011 to 2018). Classification criteria are detailed in Section 2.2.6
Fig. 2
figure 2

Historical changes in (A) N inputs and (B) N outputs of the agricultural systems in the East African Community from 1961 to 2018. Gg is Giga grams

Total N crop uptake in the EAC increased by 5.46 kg N ha-1yr-1 from the 1960s to 2000s, with a 19% increase in the 2010s (Fig. 2B and Table 2). Except for Tanzania, which had a low total N crop uptake, other states were rated extremely low (Table 2). Recently, all states had low to moderate total N crop uptake (Table 2). NUE decreased from 102% in the1960s to 85% in the 2000s and 81% in the 2010s (Table 2). There were some variations in NUE statewide (Table 2). N surplus amount in the EAC increased from -0.3 kg N ha-1yr-1 in the 1960s to 3.3 kg N ha-1yr-1 in the 2000s, increasing 56% in the 2010s (Table 2). Tanzania presented a positive N surplus rate over the studied periods, while Kenya recently presented the highest N surplus (Table 2). Generally, for all EAC states, the N surplus increased through time, but remained negative until the 2000s; after that, in the 2010s, we observed a positive increase in N surplus for most states (Table 2). The estimated losses of N through gaseous emissions of (NH3, N2O, and NO) and leaching that increased 2.0 kg N ha-1yr-1 from the 1960s to 2000s, and recently, it increased about 52% (Fig. 2B and Table 2). N losses were extremely low to low from the 1960s to 2000s, while they became moderate for Kenya and Rwanda during the 2010s (Table 2). From the 1960s to 2000s, soil N stock increased from -2.0 Kg N ha-1yr-1 to -0.5 Kg N ha-1yr-1, respectively (Fig. 3A and B). Later, in the 2010s, it increased up to 0.3 Kg N ha-1yr-1 (Fig. 3C).

Fig. 3
figure 3

N fluxes and cycling (expressed in Gg N yr-1) in the agricultural systems of the East African Community within the periods of (A) the 1960s (from 1961 to 1970), (B) the 2000s (from 2001 to 2010), and (C) the 2010s (from 2011 to 2018)

For many years, agricultural production in the EAC has been dependent on depleting soil N stock without supplying enough soil N from external sources, resulting in both lower crop yields and soil N stock mining and depletion. Smallholder farmers in the region rarely utilize synthetic fertilizer due to problems related to poor infrastructure, late fertilizer delivery, lack of credit at planting, few input suppliers, and inadequate fertilizer blending and application rates that fail to match local soil conditions (Ricker-Gilbert 2020). In the 1990s, Kenya spent more than 30% of its foreign revenues on fertilizer imports (Mugabe 1994). Synthetic fertilizers are too expensive for subsistence and small-scale farmers in the region (Kiboi et al. 2019; Ntinyari et al. 2022). For example, from 2010 to 2018, the average cost of 1 kg of urea fertilizer was USD 1.32 in Rwanda, USD 1.49 in Uganda, USD 1.35 in Tanzania, USD 1.51 in Burundi, and USD 0.97 in Kenya (Cedrez et al. 2020). Therefore, because less than half of the SNF applied to African farms is used by the crops (Lassaletta et al. 2014), some farmers believe fertilizers sold in the region are of poor quality and can damage their farms (Bold et al. 2015; Elrys et al. 2019a; Michelson et al. 2021), continuous cropping with little or no fertilizer application (Niyuhire et al. 2017; Apanovich and Lenssen 2018), high leaching caused by heavy rainfall (Table S1), and the region's per capita income is among the lowest in the world (Geiger 2018). These factors have contributed to the severe soil N stock depletion and low use of fertilizers in the region.

3.2 Comparison of the EAC agricultural systems with other regional estimates

The agricultural systems estimate of the EAC was the lowest compared to values reported for other regions in the world (Table 3). Unlike in other regions where SNF application frequently dominated the total N input, the N inputs in ANM and BNF were the EAC's largest contributors to the total N input (Table 3). This region had the lowest SNF rate, accounting for only 23% of total N input. Based on these findings, the EAC had too little N available for sustainable agricultural production. A shortage of agricultural N inputs has limited local agriculture's ability to feed the huge population while also contributing to economic growth (Zhou et al. 2014). ANM and BNF accounted for up to 57% to 60% of crop yields in both the EAC and African agricultural systems. The EAC has the world's lowest total N crop uptake, but there are substantial opportunities to increase it through organic fertilizer practices (Muller et al. 2017; Ntinyari et al. 2022). In middle-income countries such as China and India, SNF rates were higher than in developed regions, with NUE values of less than 30% and high N surplus (Table 3), can be indicatives of severe environmental pollution (Evenson and Gollin 2003; Xu et al. 2014). On the other hand, in the EAC and throughout Africa, a lack of N fertilizers and low N surplus indicate a shortage of soil nutrients to enable crop production, and high soil N stock mining and depletion (Davidson 2009; Zhou et al. 2014; Harerimana et al. 2021). The EAC and Africa had higher NUEs than high-income countries (Table 3) due to low N fertilizer use at the expense of depleting soil resources, suggesting that N outputs other than N uptake by crops are low compared to inputs. However, a recent change from negative to positive soil N stock (Fig. 3C) and N surplus (Table 2) observed in the EAC may suggest the transformation of the region's highly depleted soil into relatively fertile soil through agricultural practices that require the provision of soil nutrients from external sources and the effective use of resources to sustainably feed a rapidly growing population.

Table 3 Comparison of agricultural systems of the East African Community and global regions in 2009 (fluxes are in kg N ha-1yr-1). * Estimate of this study. a Calculated from cropping systems data by Billen et al. (2014). b Calculated as synthetic N fertilizer + biological N fixation + animal N manure + atmospheric N deposition. c Calculated using Equation (3). d Calculated using Equation (2)

3.3 Benefits of manure and BNF practices for EAC agricultural systems

In this study, the rise in livestock numbers (Table 1) was accompanied by an increase in the amount of ANM applied to cropland, increasing by 121 Gg N yr-1 (from 1960s to 2000s) and 62 Gg N yr-1 (from 2000s to 2010s). Meanwhile, soil nutrient depletion has been considerably reduced (Fig. 3A-C) and the total N crop uptake has been raised (Table 2). Although manure is regarded as a problematic waste in intensive farming systems in developed countries, it is a valuable resource for most Africans in areas where fertilizer use is limited (Rufino et al. 2007; Ndambi et al. 2019), and this trend is expected to continue (Snijders et al. 2009). Small-scale farmers in many agricultural systems in Sub-Saharan Africa keep cattle for manure production (Sileshi et al. 2019). Livestock manure applied to depleted soil can boost crop yields by providing not only essential macronutrients and micronutrients to the soil, but also organic matter to improve the soil's physical and chemical properties (Ndambi et al. 2019; Ozlu et al. 2019; Sekaran et al. 2020; Unagwu et al. 2021). The unequal rates in ANM among EAC states (Table 2) are the result of different manure management policies (Zake et al. 2010; Teenstra et al. 2014; Ndambi et al. 2019) and the number and age of livestock. The high NUEs of more than 80% observed for most states (Table 2) are likely due to low total N input to highly depleted soils. The regional agricultural soils have insufficient stocks of other macronutrients, such as phosphorus (P), potassium (K), and sulfur (S), as well as micronutrients (Hengl et al. 2017; Kihara et al. 2020; Magnone et al. 2022). The availability of these nutrients in soil can improve crop use of applied N and enhance N-fixing capacity (Divito and Sadras 2014; Duncan et al. 2018; Pooniya et al. 2018). Through the conversion of amino acids and proteins, K and S, in particular, can significantly improve the uptake of N by crops and the N cycle within crops (Capaldi et al. 2015; Duncan et al. 2018). Crops participating in BNF are especially vulnerable to P, K, and S deficiencies since these nutrients impact BNF directly by regulating rhizobia growth, nodule formation, and function, or indirectly by altering host plant growth (Divito and Sadras 2014). A sufficient supply of these nutrients can therefore enhance NUE and BNF while also lowering environmental contamination by reducing the amount of N that may be leached from the soil. ANM may be more environmentally friendly than SNF since manures contribute to effective soil management by providing nutrients in sufficient amounts, proportions, and forms (Cai et al. 2019; Barbieri et al. 2021). All livestock manures are rich in nutrients that crops require to survive (Rayne and Aula 2020; Bhunia et al. 2021). However, the levels of each nutrient may vary greatly depending on the animal's food and the amount and type of bedding utilized (Rayne and Aula 2020; Prado et al. 2022). Therefore, maintaining a high proportion of ANM intake by crops while reducing N losses to the environment in terms of NUE is critical for a sustainable EAC agricultural systems.

Enhanced BNF practices can be helpful on all agricultural fields where N availability is a critical limiting factor in crop yield (Kebede 2021). In Uganda, BNF practices can provide 22% of N inflows for perennial crops and 44% for annual crops (Nkonya et al. 2008). It can also provide more than half of the fertilizer required to produce crops on most marginal lands in Kenya and Tanzania, emphasizing the importance of BNF practices in ensuring sustainable and low-cost production by small-scale farmers in the region (Mugabe 1994). The moderate BNF rate observed in Rwanda (Table 2) can be attributed to Rwandans' high cultivation of beans (Harerimana et al. 2021). In depleted soils, legumes can fulfill up to 90% of their N requirements through BNF (Mosier et al. 2021). By reducing external inputs and enhancing internal resources, BNF practices can sustain agricultural systems and have saved the region from high fertilizer prices and pollution (van Heerwaarden et al. 2018; Kelm et al. 2008). Additionally, Lassaletta et al. (2014) found BNF to be more efficient than SNF. Intensification of legumes can increase crop nutrient uptake and improve NUE by enhancing soil quality and transfer functions, as well as boosting BNF input (Bloem et al. 2009; Kebede 2021). Therefore, the high NUE observed in the EAC (Table 2) is also likely to be explained by the fact that the regional agricultural systems are largely dependent on BNF, and since BNF can improve the NUE of depleted lands through perennialization (Córdova et al. 2019; Mosier et al. 2021).

3.4 Implications and perspectives

Our findings suggest that over the last five decades, agricultural intensification has resulted in considerable improvements in N flow throughout the EAC agricultural systems. After many years of soil nutrient mining and depletion, changes in the 1960s (Fig. 3A) and 2000s (Fig. 3B) included modernizing traditional farming and focusing overall soil fertility restoration. The 2010s (Fig. 3C) showed the most substantial rise in N inputs, along with a considerable increase in crop yields. In degraded soils, such as those in EAC (Blake et al. 2018; Lohbeck et al. 2018; Kuria et al. 2019), soil N stocks are often reduced, making production even more reliant on external N inputs (Mosier et al. 2021). A growing body of research has shown that depleted soils can be restored while still being productive (Asbjornsen et al. 2014; Bell et al. 2020; Mosier et al. 2021). For several years, the EAC states had negative N surplus (Table 2), suggesting a shortage of N; most states had relatively low SNF rates; and BNF and ANM were the primary sources of variation in N surplus (Table 2). Moreover, soil N stocks were negative from the 1960s (Fig. 3A) through the 2000s (Fig. 3B). We recently noticed positive trends in N surplus and soil N stock with high NUE (Table 2 and Fig. 3C), suggesting that N outputs other than N uptake by crops are low compared to inputs, implying that N would be conserved. Therefore, they may have evolved into N-conserving agricultural systems, with most N inputs becoming part of the harvest or being stored, ready to supply it to subsequent crops (Mosier et al. 2021). Because of the limited use of SNF and the potential benefits of ANM and BNF (Chianu et al. 2011; Barbieri et al. 2021), continuous agricultural production on degraded and depleted soils necessitates the strengthening of policies and interventions to ensure adequate food production for the EAC's population today and in the future. We propose some manure and BNF management practices that could boost crop yields while preserving soil fertility and the environment.

The need for large labor forces to process and transport organic materials in bulk, as well as enough organic residues to provide soils with sufficient nutrition for optimal crop production (Omotayo and Chukwuka 2009), continue to limit the use of manure-based soil nutrient management systems. While the region has sizeable agricultural land and a higher fraction of younger laborers (Ciceri and Allanore 2019; Elrys et al. 2019a), most young people dislike dealing with manure, so the task is mostly carried out by the elderly (Materechera 2010). Consequently, in this study, only 3.5%, 5.5%, and 5.3% of the total quantity of livestock excreted manure during the 1960s, 2000s, and 2010s, respectively, were applied to cropland as ANM (Fig. 3A-C). It can be attributed to poor labor, poverty, and inadequate knowledge resulting in massive losses of nutrients during manure storage and transport, decreasing manure quality as fertilizer, and rising greenhouse gases (Ndambi et al. 2019; Shakoor et al. 2021). Therefore, manure can still pose environmental hazards if its N content is not utilized effectively (Sefeedpari et al. 2019; Harerimana et al. 2021). Combining crop and livestock farms, and targeting their waste for efficient reuse, can help reduce N losses and improve NUE (Yang et al. 2018; Iqbal et al. 2021). An emphasis should be placed on the cautious recycling of animal excretions in time to enable the soil to capture nutrients required for plant growth and development (Materechera 2010; Röös et al. 2018). Depending on livestock and manure management practices, manure may not always provide the necessary nutritional balance for crops (Ndambi et al. 2019; Adekiya et al. 2020). Therefore, to maximize the benefit from manure in EAC agricultural systems, the 4R nutrient stewardship concept should be implemented (Jones 2021; Johnston and Bruulsema 2014). Manure should match crop nutrients (the Right source), manure nutrients should be available when crops need them (the Right time), the amount of manure should match what the crop needs (the Right rate), and manure should be kept where crops can use them (the Right place). These practices have the potential to increase manure use efficiency and crop yields. Policymakers should encourage farmers to use and manage manure since most cannot afford high-quality fertilizers.

Agricultural systems would be more sustainable if BNF could enhance N production (Goyal et al. 2021). According to Mugabe (1994), Africa could have reduced its reliance on fertilizer imports if it had used BNF fully. Unfortunately, numerous challenges, including the abundance of soil rhizobia (Denton et al. 2013), lack of scientific skills, insufficient funding for agricultural research and extension, low-quality inoculants, and poor soil conditions (Van Zwieten et al. 2015), limit BNF practices in agricultural systems in the region (Chianu et al. 2011). Many studies have demonstrated that inoculation with Rhizobium increases grain legume yields, thereby saving land, and is seen as a low-cost insurance policy for better yields in Africa (Ndakidemi et al. 2006; Chianu et al. 2011; Giller et al. 2013; Vanlauwe et al. 2019). For example, 100 g of Biofix (a Rhizobium inoculant developed in Kenya) costs around USD 1.25 and can inoculate up to 15 kg ha-1 of common bean seeds. It is much less costly than the 90 kg of SNF required for the same quantity of seeds per hectare, which may cost around USD 12.50 (Raimi et al. 2021). However, even though inoculation technology was established in the 1980s in the region, farmers' demand for inoculants is low (Raimi et al. 2021), likely due to low-quality rhizobia inoculants and poor soil conditions (Abd-Alla et al. 2014; Herrmann et al. 2015; Ferreira et al. 2016; Horel et al. 2019) that prevents legumes from fixing high amounts of N2 (Jefwa et al. 2014). Therefore, adopting high BNF level requires improving agricultural practices, such as selecting appropriate legume genotypes, inoculation with effective rhizobia, and implementing appropriate agronomic practices and cropping systems (Balume et al. 2013; Kebede 2021). Moreover, biofertilizer research needs to be strengthened (Raimi et al. 2021).

While our N budget approach can give insight into specific N emissions, leaching, deposition, BNF, fertilizer inputs, and N crop uptake across agricultural systems, our estimates were associated with high uncertainties due to inherent constraints in the methodologies utilized or differences in data quality among estimations. After 10,000 Monte Carlo simulations of the data from the 1960s, the average N surplus was -3.33 Gg N yr-1, with a 95% certainty range of -166.04–141.47 Gg N yr-1; the average soil N stock was -27.21 Gg N yr-1, with a 95% certainty range of -186.62–116.62 Gg N yr-1; and the average NUE was 104%, with a 95% certainty range of 28–278% (Table S5). In the 2000s, the average N surplus was -20.5 Gg N yr-1, with a 95% certainty range of -314.09–276.41 Gg N yr-1; the average soil N stock was -115.45 Gg N yr-1, with a 95% certainty range of -408.75 – 163.13 Gg N yr-1; and the average NUE was 107%, with a 95% certainty range of 53–231% (Table S5). In the 2010s, the average N surplus was 160.61 Gg N yr-1, with a 95% certainty range of -211.90–603.67 Gg N yr-1; the average soil N stock was 12.23 Gg N yr-1, with a 95% certainty range of -370.22–432.6 Gg N yr-1; and the average NUE was 82%, with a 95% certainty range of 48–160% (Table S5). During the 2010s, for example, the biggest contributors to uncertainty were BNF, N crop uptake, SNF, and ANM (Table S6). BNF contributed 34% of the variability of the N surplus, 38% of the soil N stock, and 32% of the NUE. N crop uptake contributed 15% of the variability of the N surplus, 17% of the soil N stock, and 26% of the NUE. SNF contributed 31% of the variability of the N surplus, 26% of the soil N stock, and 24% of the NUE. ANM contributed 12% of the variability of the N surplus, 13% of the soil N stock, and 11% of the NUE. The amount of BNF was estimated using specific conversion factors, which included uncertainties due to crop variability and local environmental factors. Since it is challenging to measure N inputs from the BNF due to a lack of related information in the EAC, our estimations were based on various parameters. More research on N-fixation in agricultural production systems is needed in the EAC to minimize uncertainty in future N budget studies. Based on crop yields and their N content, N crop uptake was determined. However, the climate, soil fertility, water availability, diseases, pests, and farm management all have an impact on crop production. Due to the absence of these considerations in this study, there are significant uncertainties in the estimate of the total N crop uptake. It is recommended that while estimating N crop uptake, future research take into consideration several factors impacting crop yields. The calculation of N fertilizers used on crops was fraught with uncertainty since we could not account for the low quality of synthetic fertilizers used in the region, which was not considered when estimating SNF. Moreover, this study could not account for the fact that manure management practices varied throughout the EAC states, which created some uncertainty. It is recommended that different fertilizer management practices and quality be considered in future N budget studies. Due to various limitations, additional uncertainties were present in other input parameters. For example, we estimated atmospheric N deposition input using Dentener et al. (2006)'s estimated atmospheric N deposition rate in agricultural systems multiplied by the entire cropped area per year, although N gas volatilization fluctuates and is impacted by on-farm management practices and weather. For accurate estimation of atmospheric N deposition input into EAC agricultural systems, precise data from atmospheric N deposition monitoring stations are required. When estimating gaseous losses, we used the territorial emission factors suggested by Bouwman et al. (2002) and FAO (2001), which appear to be out of date. In addition, we used a uniform factor for all countries to assess N losses on hydrological paths, assuming that 10% of the applied N fertilizer leaches. However, a variety of factors may influence the N loss from applied N fertilizer. These N loss mechanisms may vary even on the same farm and may generate different values in different countries. Also, the estimation of gaseous and hydrological losses was limited to only the SNF and ANM applied to cropland due to a lack of emission factors for other sources of N loss, such as the BNF and atmospheric N deposition. Future research should avoid this type of uncertainty. The input parameters used to calculate the N surplus, soil N stock, and NUE of the EAC agricultural systems were prone to uncertainties, which influenced the study's results. However, our results roughly provide important information to advance our understanding of N inputs, outputs, and cycling within the EAC agricultural systems. This research can serve as a model for management practices aimed at restoring regional soil fertility and enhancing agricultural yields. The aforementioned sources of uncertainty should be highly prioritized and supported by decision-makers and researchers in order to ensure that future N budget calculations are far more certain.

4 Conclusion

This study contributes to a regional estimate of the N budget for agricultural systems in the EAC in order to better understand changes in N inputs and outputs over the last five decades and to propose appropriate and cost-effective management practices for restoring and improving soil fertility. Here we show for the first time that the agricultural production sector in the EAC is shifting from soil mining or depletion systems to relatively fertile systems because more nitrogen is being supplied from external sources, such as animal manure and BNF. Although there are uncertainties in the calculations, the estimates provide important information on the reduction of regional soil N depletion. Based on our results, we suggest that, where crop yields and soil fertility are low in the EAC region, the management practices of manure application and legume-based plant cultivation should be improved due to their potential to increase crop yields and improve soil fertility in the EAC region.