A steady drumbeat of new natural-gas plants have replaced coal as the dominant source of electricity generation in the U.S.

At the beginning of 2016, America’s coal production fell to its lowest level in 30 years. The march away from coal is cheered by those who would like to see the U.S., and the world, move to a lower-carbon economy.

But the increasingly heavy reliance on natural gas has exacted a toll. The energy-associated carbon dioxide emissions from natural gas are expected to top the CO2 emissions from coal for the first time more than 40 years, according to the U.S. Energy Information Administration.

Source: U.S. Energy Information Administration

Coal’s carbon intensity is about 82 percent higher than natural gas’ carbon intensity. But natural gas is used not only in electricity but also for heating. Last year, natural gas consumption for energy was 81 percent higher than coal consumption, bringing their CO2 emissions to a nearly equal footing.

Despite the rise in natural-gas carbon emissions, overall carbon intensity in the U.S. has been falling overall in recent years. But that cannot be attributed entirely to the switch from natural gas to coal. Instead, the increasing mix of renewables, primarily wind and solar, has also been key to pushing the country’s carbon intensity to lower levels.

Source: U.S. Energy Information Administration

The reliance on natural gas also has another downside: a lack of fuel diversity that can be a problem when supplies are in high demand, such as during the recent polar vortex. Earlier this month, Massachusetts governor Charlie Baker signed a law requiring his state to adopt more renewable energy to meet its greenhouse gas reduction targets, but also to ensure fuel diversity, which is a concern across gas-reliant New England.

In some regions of the U.S., utility-scale solar is already cheaper than the cost of fuel for a natural-gas plant. In most of the U.S., however, the levelized cost of solar won’t compete with natural gas until closer to 2030, according to Bloomberg New Energy Finance, although onshore wind might compete with coal and natural gas across the U.S. within a decade.