Africa has a bright future ahead of it. Productivity and growth will improve as African economies continue to place more emphasis on services and manufacturing, pursue commodity production, and achieve quick gains in agriculture and light industry.

But African countries’ success presupposes that they generate and manage energy sustainably to keep up with increasing demand. In the next 35 years, Africa’s population will continue to rise, with a projected 800 million people across the continent moving to cities. And Africans are already disproportionately exposed to the adverse effects of climate change, even though they are collectively responsible for less than 4% of global greenhouse-gas emissions.

Urban areas will have to reduce environmental stresses by promoting low-carbon energy systems, electric mass transportation, and energy-efficiency initiatives, as well as the use of cleaner cooking fuels. And rural areas can create new opportunities that reduce the need for urban migration, by expanding renewable energy systems and energy access.

But even with these measures, providing enough energy for a modern, inclusive economy will not be easy. Africa already experiences frequent power outages, even though more than 600 million people there do not have access to electricity, and current demand is relatively modest.

To avoid the harmful spillover effects of high-carbon economic growth, Africa will have to undergo a “climate smart” energy revolution. African countries will need to build climate-resilient infrastructure and tap into the continent’s abundant renewable-energy resources. Doing so will broaden access to energy, create green jobs, reduce environmental pollution, and enhance energy security by diversifying sources.

At the same time, Africa’s energy revolution will itself be challenged by some of the worst effects of climate change. For example, as rainfall becomes more erratic, hydropower production and revenues may decline. This risk can be managed by modifying existing investment plans to account for large climate swings. Still, for the region to adapt, the United Nations Environment Programme estimates that it will need annual investments of about $7-15 billion by 2020, and $50 billion by 2050.

Rather than treating new climate-related risks as hurdles to overcome, we should view them as opportunities for investment and innovation. We are standing on the threshold of an exciting new era in which technological progress allows us to use a range of conventional and unconventional energy options (excluding nuclear energy).

African countries can now combine energy sources to adapt to realities on the ground. Unlike in past decades, they no longer need be tied to a single energy source. And, because much of Africa’s energy infrastructure remains to be built, governments have a chance to get their energy and infrastructure policies right the first time, thereby maximizing returns on investment.

Policymakers should take a few key steps to help transform Africa’s energy sector and boost long-term economic growth. For starters, making it easier, safer, and more financially attractive for private investors to enter power markets would boost competition, thereby spurring innovation and lowering costs. Moreover, African countries should seek opportunities to share infrastructure and create cross-border power pools.

Another important step is to invest in renewable energy. Africa has an exceptionally rich portfolio of clean-energy assets, including almost nine terawatts of solar capacity, more than 350 gigawatts of hydropower capacity, and more than 100 GW of wind-power potential. This is more than enough to meet the continent’s future demand.

At the same time, renewable-energy sources are becoming less expensive, making them increasingly competitive with fossil-fuel alternatives. For example, the price of utility-scale photovoltaic solar energy in Africa fell by 50% between 2010 and 2014, and continues to decrease today. And South Africa’s Renewable Energy Independent Power Producer Procurement Programme has seen an overall decline in bid prices and oversubscription rates.

Innovative off-grid and mini-grid electricity-distribution systems, meanwhile, are already transforming Africa’s energy landscape and multiplying the ways to exploit clean-energy sources and expand electricity access for the poor, particularly in areas where consumers are widely dispersed. Companies such as M-kopa and Mobisol have made small solar-energy systems available to thousands of African homes, by allowing their customers to pay in instalments on their mobile devices.

Still, to accelerate a market shift on the scale that Africa needs will require increased financing from export credit agencies, development banks, commercial financial institutions, and other cross-border sources.

Africa has a chance to bring hundreds of millions of people without electricity into the modern economy; and we have an opportunity to pioneer the next investment frontier. Getting Africa’s energy transformation right, by pursuing a mix of policies and investments that boost diversity and strengthen resilience, will ensure a brighter future for us all.