When Kenya opened the Olkaria power plant four decades ago, it was considered more research project than commercial venture. Located in Hell’s Gate National Park, a barren zone of volcanic rock permeated by sulfurous gases and populated mostly by warthogs and zebras, the facility generated electricity using steam rising from deep in the ground. The untested and costly geothermal technology was at best experimental, with the first unit expected to supply power for perhaps 10,000 homes. Today, Olkaria generates more than 50 times that, and the technology is on track to become the backbone of the country’s electricity grid. “Our strategy going forward is geothermal,” says Rebecca Miano, chief executive officer of the state-owned Kenya Electricity Generating Co., or KenGen.

For decades, Kenya and surrounding countries focused on hydroelectric power and oil-fueled thermal stations, but lately they’ve awakened to the potential of their vast underground energy resources. The region sits astride the Great Rift Valley, an area where tectonic plates meet, bringing the magma at the Earth’s core closer to the surface. It’s one of the world’s most active volcanic zones—Mount Kilimanjaro lies at its heart—with dozens of hot springs hinting at the intense heat lying just below. Kenya gets nearly half of its electricity from geothermal plants, more than any other country, according to researcher Fitch Solutions, and it’s on track to increase that to almost three-fifths by 2030.

Olkaria, the continent’s first geothermal power station, is fed by pipes drilled almost 2 miles into the Earth’s crust. These deliver high-pressure steam as hot as 350C (662F), which is used to propel giant turbines. Over the next five years, KenGen plans to invest $2 billion in four new plants and other upgrades at Olkaria that will almost double Kenya’s geothermal capacity to more than 1.6 gigawatts—enough to power a city of 1 million. Longer term, KenGen predicts, the country has the potential to generate at least six times that.

The biggest obstacle, in Kenya and across the region, has long been the initial investment. The turbines and other equipment above ground add up to about $3 million per megawatt, but the real expense lies below the surface. A single well can cost as much as $6 million, and each unit typically requires multiple drilling attempts to find sufficient steam to keep the turbines spinning; for the first station at Olkaria, KenGen drilled 33 wells. Early on, geothermal “was thought of as too risky, and high upfront cost was a hindrance,” says Peter Omenda, a consultant who’s worked on numerous projects in the area. While technological advancements have brought down the price and made it easier to get more steam from each well, the expense of drilling remains a significant hurdle.

To help offset costs, Kenya in 2008 created the state-controlled Geothermal Development Co., which is intended to shoulder the investment risks associated with the technology. Similar to oil wildcatters, the GDC drills wells, and when it discovers a field that has potential, it sells the steam to KenGen or others that build the above-ground infrastructure. The GDC has raised $746 million, mainly from international lenders such as the World Bank, to develop the Menengai Crater, a site about 60 miles north of Olkaria where three independent power producers expect to open geothermal plants in 2023, after years of delays.

Competition from other renewables, which can be faster to build and promise a more rapid return on investment, is another concern. Kenya gets about 12% of its electricity from wind and solar, up from less than 1% five years ago. Unlike those technologies, though, geothermal doesn’t require a stiff breeze or sunny skies to provide a steady flow of energy. And when compared to hydropower—which Kenya is also counting on as it seeks to get to 100% renewable sources by 2030—geothermal plants aren’t threatened by droughts or belligerent neighbors that might cut off the water supply. “Geothermal provides clean, non-intermittent baseload electricity that other sources of renewables cannot,” says Derrick Botha, an analyst with Fitch Solutions.