Introduction

The continuous growth in the global energy demand results in rises in greenhouse gas emissions. CO2 emissions generated from fossil fuels account for about 80% of greenhouse gas emissions in the world (Li et al. 2020) and are the leading cause of climate change and global warming (Usman et al. 2020; Anser et al. 2021; Nguea 2023a). Carbon emissions climbed from 1174 million tons in 2010 to 1372 million tons in 2021, and they are expected to reach 2179 million tons by 2050 (IEA 2022). The data from IEA (2022) reveal that global oil demand has risen from 88.4 million barrels per day (mb/day) in 2010 to 96.7 mb/ in 2021, accounting for 37.9% of the world’s energy consumption. In addition, oil generated 32.21% of world CO2 emissions in 2021 (IEA 2022). However, the price of oil has increased from USD 96 per barrel in 2010 to an average level of USD 105 per barrel in 2022 (IEA 2022). Although Africa’s CO2 emissions trend is rising, less than 4% of global emissions come from Africa, which is the region that emits the least in the world. Furthermore, most African countries rely heavily on natural resources like oil. Thus, changes in energy prices are likely to cause environmental degradation to rise while economic growth and energy demand rise. African governments as well as the populace face social, environmental, and economic issues as a result of the continent’s highest pace of urbanization during the past 30 years. Africa is suffering from climate risks, which are expressed by the deaths of approximately 730,000 individuals and losses to African economies of US$38.5 billion (Statista 2022). Concerns about energy security, air pollution, and oil price fluctuations have prompted developed and developing nations to implement and finance the transition towards green energy.

CO2 emissions can be impacted by oil prices in many ways. First, low oil prices can improve environmental quality by lowering national income (a fiscal effect), which could lead to reduced investments and, in turn, lessen both energy consumption and carbon emissions (Agbanike et al. 2019). Second, a decline in oil prices can stimulate consumers and businesses to use more energy, which leads to a rise in CO2 emissions and a corresponding decline in environmental sustainability (Li et al. 2020). Third, a rise in oil prices lowers the demand for energy for both home and commercial purposes, which lowers environmental pollution by lowering CO2 emissions. Fourth, high oil prices boost national income, which can lead to more infrastructure investment and, ultimately higher energy consumption and CO2 emissions (Agbanike et al. 2019). Numerous studies examining the connection between oil prices and CO2 emissions have shown that oil prices have the potential to either increase or decrease CO2 emissions. For instance, He and Richard (2010), Zaghdoudi (2017), and Mujtaba and Jena (2021) found that higher oil prices help reduce CO2 emissions. In contrast, Lin and Jia (2019) observed that an increase in the cost of energy causes CO2 emissions to increase. Likewise, Nwani (2017) and Agbanike et al. (2019) proved that higher crude oil prices contribute to the development of economic circumstances that increase Ecuador’s and Venezuela’s energy consumption and CO2 emissions, respectively.

Global population expansion has been accompanied by a significant increase in urbanization during the past 40 years. According to World Bank estimates, there were 4.13 billion urban residents worldwide in 2017 compared to 1.75 billion in 1980, a 1.4-fold increase (World Bank 2018). According to Morcillo-Bellido and Prida-Romero (2018), an increase in the level of urbanization is correlated with the development and use of infrastructure, buildings, transportation, and communication systems, all of which result in higher energy consumption and elevated air pollution. However, when urbanization levels rise, energy efficiency improves due to technological advancement, helping in the reduction of CO2 emissions. According to Sharma (2011), urbanization is anticipated to lower CO2 emissions through fostering more efficient energy use, industrial upgrading, and technological innovation. Nevertheless, contradictory findings regarding the relationship between urbanization and CO2 emissions have been revealed in several studies (Hoornweg et al. 2011; Wang and Zhao 2018; Pata 2018; Grodzicki and Jankiewicz 2022; Sharma 2011; Ali et al. 2017; Zhang et al. 2021).

A broad review of earlier empirical works demonstrates both the negative and positive effects of urbanization and oil prices on environmental quality. The role of urbanization in achieving carbon neutrality could be moderated by the cost of energy sources, including fossil fuels, which are major contributors to CO2 emissions. When oil prices rise, it becomes more expensive to use oil as an energy source. This can incentivize governments, businesses, and individuals to explore alternative energy options, such as renewable energy sources. The higher cost of oil can make renewable energy sources more economically viable and competitive, leading to their increased adoption. However, not much is known about how oil prices affect the way urbanization affects carbon emissions. Additionally, previous studies on environmental sustainability lack to account for the heterogeneous distributions of carbon emissions across countries. To close this gap, this study examines the impact of urbanization and oil prices on CO2 emissions in 35 African countries from 2000 to 2017. Understanding the relationship between urbanization, oil prices, and CO2 emissions in Africa is crucial for developing effective strategies to mitigate climate change and promote sustainable development. Consequently, this study provides answers to the following questions below: (i) What is the role played by urbanization and oil prices in achieving carbon neutrality in Africa; (ii) Do oil prices moderate urbanization to reduce CO2 emissions in Africa; (iii) Is the extent and direction of the impact of urbanization and oil prices on CO2 depending on the country’s level of emissions?

The following ways that this inquiry adds to the literature: (i) This study is the first to investigate the moderating role of oil prices in the nexus between urbanization and CO2 emissions; (ii) Within the EKC framework, this analysis looks at the effects of the global financial crisis and renewable energy consumption, in addition to the effects of oil prices and urbanization; (iii) By examining the validity of inverted U-shaped connection between urbanization and carbon emissions in African countries, this study will contribute to analyze the trajectory of urbanization and its impact on the environment in Africa; (iv) This study is also the first to the best of the authors’ knowledge that investigates the role played by urbanization and oil prices in African countries accounting for the level of emissions; (v) This paper employs Driscoll-Kraay standard errors and instrumental variable (IV) estimation based on the fixed effect (FE) 2-step generalized method of moments (GMM) approach (IV-GMM) to address the panel data issues of heterogeneity, autocorrelation, cross-sectional dependence, and endogeneity that could biased estimation results, while the Dumitrescu-Hurlin (DH) granger causality test is used to determine causality between the variables.

The rest of the study is structured as follows: The “Literature review” section presents the literature review, while the “Methodology and data” section details the methodology approach. The empirical findings are presented and discussed in the “Results and discussion” section. The “Conclusion and policy implications” section presents the conclusion and policy recommendation.

Literature review

The concept of carbon neutrality has gained significant attention in recent years, with many countries, organizations, and individuals committing to achieving carbon neutrality. This commitment is driven by the recognition of the urgent need to address climate change and the understanding that reducing carbon emissions is essential for a sustainable future. To achieve carbon neutrality, various strategies and measures have been implemented. These include reducing energy consumption, transitioning to renewable energy sources; improving energy efficiency; implementing carbon capture and storage technologies; and offsetting remaining emissions through activities such as reforestation or investing in carbon offset projects. Empirically, several factors have been found to affect the route towards carbon neutrality, including foreign direct investment (Udemba 2021), trading prices (Deng et al. 2023), green technology (Wan et al. 2021; Dong et al. 2022) environmental policies (Chen and Lin 2021) and carbon taxes (Wang et al. 2022), resource dependence and trade openness (Ibrahim 2022), and industrialization and urbanization (Ahmed et al. (2021). However, this study focuses on separate factors that were sparse in earlier studies, for instance, urbanization and oil prices, and divided the literature into two sections.

Oil prices and carbon emissions

The link between oil prices and CO2 emissions is due to the relationship between oil consumption and greenhouse gas emissions. When oil prices are low, it becomes more affordable for individuals and industries to consume oil and its derivatives, such as gasoline and diesel (Murshed and Tanha 2019). This increased consumption leads to higher CO2 emissions. On the other hand, when oil prices are high, the cost of oil-based products increases, which can incentivize individuals and industries to reduce their consumption and seek alternative energy sources (Al-Mulali and Ozturk 2016). This can result in lower CO2 emissions. Additionally, fluctuations in oil prices can impact the economic viability of renewable energy sources. When oil prices are low, renewable energy sources may be less competitive in terms of cost, leading to a higher reliance on fossil fuels and subsequently higher CO2 emissions. Conversely, when oil prices are high, renewable energy sources may become more economically attractive, leading to a reduction in CO2 emissions.

The impacts of oil prices on carbon emissions have been extensively studied in the literature. Katircioglu (2017), for instance, looks into the oil price-CO2 emission nexus in Turkey and discovers that a rise in oil prices lowers CO2 emissions. Similar findings are made by Mujtaba and Jena (2021) in India. Using a fixed effect model, Mahmood and Furqan (2020) investigate the growth impact of oil prices on carbon emissions in six Gulf Cooperation Council countries from 1980 to 2014. The results show a negative and significant impact of oil prices on carbon emissions in the long run. Umar et al. (2021) discovered that energy price reduces CO2 emissions in 13 African countries using Augmented Mean Group (AMG) and Pooled Mean Group (PMG) methods. Mensah et al. (2019) investigate this connection in the context of South Africa and find that higher oil prices lead to lower CO2 emissions. According to Wang and Li (2016), the carbon intensity is reduced (stimulated) by an increase (reduction) in energy price. A reduction or increase in crude oil prices results in an asymmetric decline over time, according to Constantinos et al. (2019)’s analysis of the connection between crude oil prices and CO2 emissions. Through the Fully Modified Ordinary Least Square (FMOLS) technique, Rasheed et al. (2022) discovered that an increase in oil prices lowers CO2 emissions in 30 European nations.

Malik et al. (2020) used the ARDL model to investigate the effect of oil price shocks on CO2 emissions in Pakistan from 1971 to 2014 and provided results that suggested that while rising oil prices lead to a short-term increase in carbon emissions, they will eventually decline. According to the market spectrum, energy pricing has different effects on carbon output in the USA, as demonstrated by research by Hammoudeh et al. (2014). On the other hand, Li et al. (2020) draw their conclusions about how energy prices affect CO2 emissions by looking at the energy structure, energy efficiency, industrial structure, and economic development based on provincial panel data from China. Higher crude oil prices, according to a study by Agbanike et al. (2019), increase government size and energy consumption, which boosts CO2 emissions. Similar to this, Alshehry and Belloumi (2015) investigate the impact of oil prices on Saudi Arabia’s economic growth and CO2 emissions. They discover that an increase in oil prices increases energy consumption and harms the environment by stimulating CO2 emissions. Based on the preceding arguments, the following hypothesis is proposed:

  • Hypothesis 1: Higher oil prices have a significant negative impact on carbon emissions.

Urbanization and carbon emissions

Urbanization refers to the process of population growth and the expansion of cities, resulting in the development of infrastructure, industries, and increased human activities. There is a strong theoretical link between urbanization and pollution due to several factors. First, urban areas often witness rapid industrial growth, with the establishment of factories, power plants, and manufacturing units. These industries release various pollutants such as greenhouse gases, particulate matter, and toxic chemicals into the air, water, and soil, contributing to pollution (Sadorsky 2014). Urbanization leads to increased vehicular traffic, resulting in higher emissions of pollutants from cars, buses, and trucks. The combustion of fossil fuels in vehicles releases pollutants like carbon monoxide, nitrogen oxides, and volatile organic compounds, which contribute to carbon emissions (Ohlan 2015). However, as countries continue to urbanize and their income levels rise, there is potential for a shift towards more sustainable development practices (Wang et al. 2016). This can include investments in cleaner technologies, improved waste management systems, and the implementation of environmental regulations.

Numerous empirical works have been conducted on the connection between urbanization and environmental quality, but the findings are mixed. For a panel of 99 countries, Poumanyvong and Kaneko (2010) use the STIRPAT model and discover that urbanization boosts CO2 emissions. Using data from 20 developing countries, Zhu et al. (2012) validate the EKC hypothesis for the relationship between urbanization and CO2 emissions, suggesting that carbon emissions are only reduced after a certain level of urbanization. Similar findings are found by Zhang et al. (2017) by employing an extended STRIPAT model for a panel of 141 countries. In the BRICS countries, Wang et al. (2016) look into this relationship. The findings show that urbanization Granger lead to higher levels of CO2 emissions. Mahalik et al. (2021) discovered the same outcomes in BRICS countries. For a panel of 44 Sub-Saharan African (SSA) nations, Salahuddin et al. (2019) studied the connection between urbanization globalization and CO2 emissions and found that urbanization stimulates CO2 emissions. In 13 EU countries, Yazdi and Shakouri (2018) found that urbanization is positively associated with the amount of CO2 emissions. The ecological footprint of the next-11 countries is also examined by Danish and Wang (2019) who look at the heterogeneous effects of urbanization, energy use, and growth (Table 1). According to the results, urbanization and energy use hurt the environment. In 10 developing countries, Awan et al. (2022) look into the link between renewable energy consumption, FDI, internet, urbanization, and CO2 emissions. The results based on the Method of Moment quantile regressions show that renewable energy reduces CO2 emissions even when urbanization rises. Cui et al. (2022) examine the effect of urbanization, renewable energy use, and structural change on the ecological footprint. The findings indicate that while human capital and renewable energy lessen environmental pressure, economic complexity, economic growth, and urbanization enhance it.

Table 1 Summary of the literature review

Sharma (2011), however, divides 69 countries into three panels (high-, medium-, and low-income countries) over the years 1985 to 2005 and discovers that urbanization mitigates CO2 emissions regardless of the sub-panel. Li and Lin (2015)’s research established that the level of income moderates the effect of urbanization on CO2 emissions. According to the findings, urbanization boosts CO2 emissions in low-income countries while lowering them in high- and middle-income countries. Some other studies find that the level of urbanization affects CO2 emissions differently. Zhang et al. (2021) and Grodzicki and Jankiewicz (2022) find that urbanization abates carbon emissions in countries with low levels of urbanization. Maruotti (2011) suggested that the Kuznets curve connected to urbanization may be followed by environmental damage. Similar to this, Wang et al. (2018) apply the panel quantile regression approach to examine this link on a panel of G-20 countries. The findings demonstrate that urbanization and pollution via PM2.5 concentrations have an inverted U-shaped connection. Based on the above discussion, the following hypothesis is formulated:

Hypothesis 2: Urbanization has a significant positive impact on carbon emissions.

From the thorough discussion, it can be revealed that urbanization leads to increased energy demand as more people move to cities and require energy for transportation, housing, and industries (Hubacek et al. 2009; Zhang and Lin 2012; Geng et al. 2014). This increased energy demand often relies heavily on fossil fuels, including oil, which contributes to CO2 emissions. Besides, oil prices play a crucial role in determining energy consumption patterns. When oil prices are low, it becomes more affordable for individuals and industries to use oil-based energy sources, leading to increased consumption and subsequently higher CO2 emissions. Conversely, high oil prices can incentivize the adoption of alternative energy sources, reducing CO2 emissions (Agbanike et al. 2019; Li et al. 2020). Urbanization is closely linked to transportation patterns, with increased urbanization often leading to higher vehicle ownership and usage (Lin and Du 2015). As oil is a primary fuel source for transportation, the interaction between urbanization and oil prices could influence the choice of transportation modes and fuel consumption, thereby impacting CO2 emissions. However, the impact of urbanization and oil prices and then their interaction on CO2 emissions can depend on the level of emissions. In countries with high CO2 emissions, the impact of urbanization and oil prices may have a limited effect on reducing emissions. Urbanization can lead to increased energy consumption and transportation demands, resulting in higher emissions. Similarly, when prices are low, it may encourage more consumption and reliance on fossil fuels, further contributing to emissions. Otherwise, in countries with low emissions, the impact of urbanization and oil prices may have a significant effect on further reducing emissions. Urbanization can be designed with a focus on sustainability, promoting walking, cycling, and public transportation, thereby minimizing the need for fossil fuel-based transportation. Higher oil prices can discourage the use of fossil fuels and encourage the adoption of cleaner energy sources, resulting in lower emissions. In light of these discussions, the last two hypotheses are formulated.

Hypothesis 3: Higher oil prices mitigate the positive and significant impact of urbanization on carbon emissions.

Hypothesis 4: The effect of urbanization and oil prices on CO2 emissions depends on the level of CO2 emissions.

All in all, the literature on the relationships between urbanization, oil prices, and CO2 emissions is inconclusive. Furthermore, a small number of studies focused on the nexus between urbanization, oil prices, and CO2 emissions in African countries. No recent empirical study has examined the moderating role of oil prices on the urbanization-CO2 emissions nexus. Lastly, the difference in CO2 emission level across African countries is ignored in the existing literature, while the evidence for the inverted U-shaped EKC link between urbanization and CO2 emissions in African countries is not investigated. This paper fills this void by analyzing the association between urbanization and CO2 emissions in the presence of oil prices while incorporating the global financial crisis, renewable energy consumption, and GDP per capita into the carbon emission model.

Methodology and data

Model and methodology

This study examines the impact of urbanization and oil prices on carbon emissions using the CO2 emission functions of Opoku et al. (2022), Acheampong et al. (2022), and Sarkodie and Adams (2018). The price of crude oil (Oil), urbanization (URB), and its squared term (URB2), renewable energy (REC), GDP per capita (GDP) and its squared term (GDP2), and the global financial crisis (Crisis) are all stated as determinants of carbon emission (CO2). As a result, Eq. (1) provides the empirical model to investigate how urbanization and oil prices affect carbon emissions.

$$\textrm{CO}{2}_{it}={\beta}_0+{\beta}_1{\textrm{Oil}}_{it}+{\beta}_2{URB}_{it}+{\beta}_3{URB}_{it}^2+{\beta}_4{REC}_{it}+{\beta}_5{GDP}_{it}+{\beta}_6{GDP}_{it}^2+{\beta}_7{\textrm{Crisis}}_{it}+{\varepsilon}_{it}$$
(1)

To capture the moderating effect of oil prices on the association between urbanization and CO2 emissions, the interaction variable between urbanization and oil prices is introduced. Equation (1) turns out to be as follows:

$$\textrm{CO}{2}_{it}={\beta}_0+{\beta}_1{Oil}_{it}+{\beta}_2{URB}_{it}+{\beta}_3{\left( URB\times \textrm{Oil}\right)}_{it}+{\beta}_4{URB}_{it}^2+{\beta}_5{REC}_{it}+{\beta}_6{GDP}_{it}+{\beta}_7{GDP}_{it}^2+{\beta}_8{\textrm{Crisis}}_{it}+{\varepsilon}_{it}$$
(2)

where i = 1…. N; t = 2000−2017; Oil denotes oil prices, while URB is urbanization. (URB × Oil) represents the interaction term between urbanization and oil price. β0 denotes a constant parameter, and εit represents the stochastic error term. The empirical models were estimated using the natural logarithm of all the variables except the global financial crisis variable.

To estimate this relationship, this study first determines the preliminary effects of associated factors on CO2 emissions using the Driscoll-Kraay standard errors approach. Driscoll and Kraay (1998) method is used to solve the issues of autocorrelation, cross-sectional dependency, and heteroscedasticity. Additionally, Hoechle (2007) contends that the Driscoll-Kraay nonparametric estimator produces reliable estimates for both cross-sectional and temporal dependence. For both balanced and unbalanced panels, the Driscoll-Kraay estimation technique offers consistent results (Hoechle 2007). While the Driscoll-Kraay estimators can help with heteroscedasticity, cross-sectional dependency, and autocorrelation, they might not be the best tools for dealing with endogeneity bias, which can result from measurement mistakes or reverse causality. To handle endogeneity issues, the instrumental variable generalized method of moment (IV-GMM) approach is adopted. The IV-GMM estimate generates long-run coefficients and is consistent with Driscoll-Kraay standard errors that are robust to autocorrelation within panels, heteroscedasticity, and “spatial” and temporal dependence even when the time dimension is relatively large (Baum et al. 2003; Boateng et al. 2021; Nguea 2023b).

Data

This study uses balanced panel data for 35 African countries from 2000 to 2017. Data accessibility determines the periodicity and sample of countries. The countries are listed in Table 10 in the Appendix.

The dependent variable is CO2 emissions measured in kiloton per capita (kt) extracted from the World Bank’s World Development Indicators (WDI 2022). The main independent variables are crude oil price and urbanization. Crude oil price measured in US$ referred to as the spot price of a barrel of benchmark cure oil used as fuel is extracted from British Petroleum (BP 2019) Statistical Review of World Energy, while urbanization is measured as a percentage of the total population (WDI 2022). Three control variables are included, namely renewable energy consumption taken as the share of renewable energy in total final energy consumption (WDI 2022). GDP per capita measured in constant 2010 US$ is used to capture the level of economic development of African countries. Lastly, a dummy variable that takes a value of 0 in years without financial crisis and 1 in years with financial crisis is used in the model to adjust for the recent global financial crisis. In the years 2008 and 2009, this variable takes the value 1, while in all other years, the value 0. The World Bank’s WDI (2022) provides information on GDP per capita and renewable energy usage, while information on the global financial crisis is taken from the International Monetary Fund’s database. The data used in the various model specifications are described in Table 2, while Table 3 reports the descriptive statistics of the variables and the correlation matrix.

Table 2 Description of variables and data sources
Table 3 Summary statistics and correlation results

Table 3 shows that the average mean is highest for the squared form of GDP per capita which takes a value of (51.849) followed by the interaction variable between urbanization and oil prices (15.002), squared term of urbanization (12.82), GDP per capita (7.13), oil prices (4.22), renewable energy (3.86), urbanization (3.51), global financial crisis (0.11), and CO2 emissions (−1.01), respectively. Considering the variances, carbon emission (1.432%) has the highest variance followed by GDP per capita (0.98%), renewable energy (0.96%), urbanization (0.46%), oil prices (0.43%), and global financial crisis (0.314%). Besides, the correlation matrix reported in the lower section of Table 3 indicates that renewable energy and the global financial crisis have a negative correlation with CO2 emissions, while urbanization and its squared form, oil prices, GDP per capita, and its squared term are positively correlated with carbon emissions.

Urbanization in Africa has been rapidly increasing over the past few decades, leading to significant changes in Africa’s CO2 emissions. As more people migrate from rural areas to cities in search of better economic opportunities and improved living conditions, the demand for energy, transportation, and infrastructure has increased rapidly. This has resulted in a surge in CO2 emissions, contributing to climate change and environmental degradation. Furthermore, Africa’s rapid urbanization has increased the reliance on oil as a source of energy. This has raised concerns about their potential impact of CO2 emissions in the region. Investigating the relationship between urbanization, oil prices, and CO2 emissions in Africa is significant in terms of addressing climate change and promoting sustainable development.

Results and discussions

This section presents and discusses the results of the findings. We first report the results of the cross-sectional dependence, heterogeneity, and panel unit root tests (“Results of cross-sectional dependence, heterogeneity and panel unit root tests” section). The “Panel cointegration test” section shows the results of the panel cointegration test, while the “Long-run estimations results” section presents and discusses the results of long-run estimates. The “Heterogeneity analysis” section highlights the results of heterogeneity analyses, while the “Panel causality test results” section presents the results of the Dumitrescu-Hurlin panel causality test.

Results of cross-sectional dependence, heterogeneity, and panel unit root tests

To avoid the problem of cross-sectional dependence, which results in skewed and inconsistent results, the cross-sectional dependence test is checked using Pesaran (2021) for the individual variables. The findings shown in Table 4 demonstrate that, at the 1% level of significance, the null hypothesis of cross-sectional independence is rejected. Additionally, the bottom of Table 4 presents the results of the heterogeneity test. The results show that the slope homogeneity hypothesis is rejected at a 1% significance level, indicating that a country in the panel has a specific heterogeneity. Further, the cross-sectional augmented Dickey-Fuller (CADF) and cross-sectional augmented IPS (CIPS) tests developed by Pesaran (2007) are used to check the stationary properties of the data. The results reported in Table 5 indicate that urbanization and its squared form, the global financial crisis, GDP per capita and its squared form, renewable energy, and CO2 emissions are not stationary at level but stationary at the first difference, thus, indicating that no variable is stationary at the second difference.

Table 4 Results of cross-sectional dependence and heterogeneity tests
Table 5 Unit root test results

Panel cointegration test

The Pedroni (2004) cointegration test is used in this study to check whether there is a long-term link between the variables. The results presented in Table 6 indicate that there is evidence of a long-term relationship between CO2 emissions, oil prices, urbanization and its squared form, consumption of renewable energy sources, per capita GDP, GDP per capita squared, and the financial crisis. All statistics reject the null hypothesis that there is no cointegration.

Table 6 The results of the Pedroni panel cointegration test

Long-run estimations results

This study makes use of the Driscoll-Kraay and IV-GMM estimate techniques to examine the effects of oil price and urbanization on CO2 emissions in the presence of control variables. Results are presented in Table 7. Even-number columns display results without the interaction term, while odd-number columns display results with it. The results show that urbanization, with coefficients ranging from 3.025 to 4.183, is positive and significant in all models. Therefore, each percentage point rise in urbanization causes an increase in CO2 emissions of about 4%. However, the coefficients of its squared term are negative and significant ranging between −0.320 and −0.454. This result suggests that as African countries undergo urbanization and experience economic growth, there will initially be an increase in environmental degradation. This is due to factors such as rapid population growth, industrialization, and increased energy consumption. However, as African cities become more developed and wealthier, they may have the resources and capacity to address environmental issues more effectively. This can lead to a decline in environmental degradation and the adoption of more sustainable practices. This outcome is consistent with Wang et al. (2018)’s related findings. The results also show that oil prices are negatively associated with CO2 emissions. According to Driscoll-Kraay estimators, a 1% increase in oil prices results in a 0.049% decrease in CO2 emissions. Additionally, the IV-GMM technique predicts that a 1% increase in oil prices reduces CO2 emissions by 0.046%. This result suggests that higher oil prices lead to increased energy costs, making it more expensive for individuals and businesses to consume energy. This can result in reduced fossil fuel consumption and potentially lower CO2 emissions. These results concur with those of Mensah et al. (2019) in South Africa, Furqan (2020) for the 6 GCC countries, and Rasheed et al. (2022) for 13 EU countries. These findings also show that energy price policies can be an effective way to promote green energy, decrease non-renewable energy, and thereby lower carbon emissions.

Table 7 Long-run estimation results

To investigate whether oil prices moderate the impact of urbanization on CO2 emissions, the interaction term between urbanization and oil price has been included in Table 7. The Driscoll-Kraay and IV-GMM approaches both produced similar results, which can be seen in the coefficients’ sign and level of significance. The interaction term’s coefficients are negative and statistically significant in both methods. This finding confirms the presence of a favorable urbanization effect of energy prices and indicates that oil price interacts with urbanization to reduce CO2 emissions. In other words, higher energy prices encourage cities to shift from non-renewable energy to renewable energy which consequently improves environmental quality. Omri and Nguyen (2014) present a convincing justification for the favorable urbanization effect of energy prices, contending that rising oil prices can make renewable energy sources more economically viable and competitive, and further encouraging their adoption. This can lead to a decline in CO2 emissions, helping to meet the net carbon objective.

Turning to the control variables, the results show that renewable energy mitigates CO2 emissions, suggesting that by increasing the deployment of renewable energy sources and integrating them into various sectors, African countries significantly reduce CO2 emissions and mitigate the impacts of climate change. It is essential to continue investing in renewable energy technologies and supporting policies that promote their adoption to achieve a sustainable and low-carbon future. These results are similar to the findings of Shafiei and Salim (2014); Erdogan et al. (2020); and Nguea (2023a). Regarding GDP per capita, the results provide evidence that supports the inverted U-shaped relationship between GDP per capita and CO2 emissions, because the coefficient of GDP per capita is significantly positive and its squared form is significantly negative. These results suggest that as a country develops economically, it will reach a point where environmental quality starts to improve. Lastly, the global financial crisis has a negative and statistically significant influence on CO2 emissions, indicating that CO2 emissions tend to decrease during the global financial crisis. Financial crises often lead to a contraction in economic activity, which can result in reduced industrial production and energy consumption. In Africa, many countries heavily rely on industries such as mining, manufacturing, and agriculture, which are energy-intensive sectors. During a financial crisis, these industries may experience a decline in output, leading to lower CO2 emissions.

Heterogeneity analysis

The above empirical results confirm the evidence of the EKC hypothesis for the relationship between urbanization and CO2 emissions, while oil prices reverse the increasing effects of urbanization on carbon emissions. So, will the impact change with the level of CO2 emissions? Therefore, this paper compared the different impacts of urbanization and oil prices on carbon emissions at two levels of emissions (low and high). To do so, the sample is divided into two groups according to the level of emissions based on data from IEA (2022). Table 8 presents the results of lower- and high-emission countries. The results indicated that urbanization has an inverted U-shaped relationship with carbon emissions across all models. Hence, whatever the level of emissions, the EKC hypothesis for the relationship between urbanization and CO2 emissions is validated. Regarding oil prices, the results of low-emission group show a negative relationship with carbon emissions. These results suggest that higher oil prices can lead to reduced consumption and a lower energy demand, potentially resulting in lower emissions. The results for high-emission countries reveal that oil prices are not significantly correlated with carbon emissions, suggesting that high oil prices do not influence the transition towards a low-carbon economy. This can be due to the fact that high-emission African countries often have a significant dependence on oil for energy production and transportation and are in majority oil-producing countries. The results also show that GDP per capita and its squared form are significantly positive and negative, respectively, validating the EKC hypothesis. Renewable energy is negative and significantly correlated with carbon emissions both in low- and high-emission countries, implying that renewable energy adoption is the best way to achieve transition to a low-carbon economy. The global financial crisis is negative and significant in low-emission countries, while its coefficient remains insignificant in high-emission countries.

Table 8 Long-run results for low- and high-emission countries

Panel causality test results

Finally, the direction of causation between oil prices, urbanization, and CO2 emissions is examined using the Dumitrescu and Hurlin (2012) heterogeneous panel causality analysis. The outcomes of the Dumitrescu-Hurlin panel causality test are shown in Table 9. The findings indicate a bidirectional causal relationship between oil prices and CO2 emissions in Africa, showing that CO2 emissions and oil prices homogeneously cause each other. This result suggests that the intensity of emissions also has a significant role in influencing energy prices, in addition to how changes in energy prices affect carbon emissions.

Table 9 Dumitrescu-Hurlin panel causality test

Additionally, the results also show that there is a unidirectional causal relationship between urbanization and CO2 emissions, which increases demands for comprehensive energy sector reforms to adopt the transition from non-renewable to renewable energy and achieve environmental sustainability by lowering CO2 emissions. This outcome is in line with Yazdi and Shakouri (2018)’s findings.

Conclusion and policy implications

Using panel data from 35 African countries from 2000 to 2017 and applying the Driscoll-Kraay and IV-GMM techniques, this study investigates the impact of urbanization and oil prices on CO2 emissions, while also taking into account the role played by the global financial crisis and renewable energy. The results confirmed the EKC hypothesis between urbanization and CO2 emissions. The results also show that oil prices, the global financial crisis, and renewable energy reduce carbon emissions. The findings indicate that urbanization interacts with oil prices to reduce CO2 emissions. Accounting for the level of CO2 emissions, the results indicate the inverted U-shape nexus between urbanization and CO2 emissions is validated in low- and high-emission countries, while oil prices and global financial crisis reduce CO2 emissions only in low-emission countries. Additionally, the interaction between urbanization and oil prices is negatively associated with carbon emissions in low- and high-emission countries. Lastly, renewable energy tends to reduce carbon emissions in low- and high-emission countries.

The results on the relationship between urbanization, oil prices, and CO2 emissions in Africa have significant policy implications in terms of addressing climate change and promoting sustainable development. Governments should promote sustainable urban planning practices that prioritize energy-efficient buildings, public transportation systems, and green spaces. This can help reduce the carbon footprint of urban areas and mitigate the impact of urbanization on CO2 emissions. Governments should also enforce stricter environmental regulations and standards to limit emissions from industries, vehicles, and other sources. This can include setting emission limits, implementing emission trading schemes, and monitoring compliance to ensure that urbanization does not lead to increased CO2 emissions. Policymakers should invest in diversifying their energy sources to reduce reliance on oil and other fossil fuels. This can involve developing domestic renewable energy industries, exploring alternative energy sources like natural gas, and promoting energy efficiency measures. Policymakers should also incentivize the adoption of renewable energy sources, such as solar and wind power, to reduce dependence on fossil fuels. This can be achieved through subsidies, tax incentives, and regulatory frameworks that facilitate the integration of renewable energy into urban infrastructure. Policymakers should provide financial incentives and support for the development and adoption of green technologies and industries. This can create new job opportunities, stimulate economic growth, and contribute to the transition towards a low-carbon economy. Governments should invest in public transportation infrastructure, promote electric vehicles, and implement policies that discourage private car usage. This can reduce the demand for oil and lower CO2 emissions from the transportation sector. Urban planners should prioritize improving access to clean and affordable energy for urban populations, particularly in low-income areas. This can be achieved through initiatives like off-grid renewable energy projects, microfinance schemes for clean energy solutions, and community-based renewable energy programs. Lastly, urban planners should implement policies that ensure equitable access to clean energy, green spaces, and other environmental benefits, while also addressing social disparities in urban areas.

This study also has some limitations. First, this paper focused on 35 African countries. Second, a panel duration of only 18 years from 2000 to 2017 was used. In the future, we expect to employ panel data covering more African countries with longer time series. Lastly, this study can be replicated in African countries at different development stages from multiple perspectives.