Solar power is burning bright. But it's not quite twilight for fossil fuels.

Robert Nickelsberg | Getty Images News | Getty Images

Solar panels are everywhere: perched on thatched roofs in rural Kenya, helping Indian farmers pump groundwater for their fields, and powering United States military bases.

Solar power accounted for more than a third of all electricity generated from energy sources that came online in 2017, a larger share than any other new source, the United Nations Environment Program said in a report issued Thursday. And solar power is becoming much more affordable. The cost of electricity from large-scale solar projects has dropped by 72 percent since 2009, according to the study.

But even as solar, along with its renewable energy cousins — like wind, biomass and geothermal power — expands, it still accounts for barely 12 percent of all the electricity that the world consumes. The greatest share still comes from fossil fuels like coal, and more coal-fired power plants continue to be built, contributing to the greenhouse gas emissions that have warmed the planet to dangerous levels.

"This shows where we are heading," said Nils Stieglitz, a professor at the Frankfurt School of Finance & Management, which produced the report along with Bloomberg New Energy Finance. "The fact that renewables altogether are still far from providing the majority of electricity means that we still have a long way to go."

Read more from The New York Times:
Dr. King said segregation harms us all. Environmental research shows he was right.
5 plants and animals utterly confused by climate change
For Scott Pruitt, a spotlight shines on his ethics, not his EPA rollbacks

The world leader in investing in renewables, by far, is China. The country accounted for nearly half of all renewable energy investments worldwide, pumping $86.5 billion into solar energy alone in 2017 in what the report described as "an extraordinary solar boom."

China has cut back significantly on coal at home, though it has continued to fund and build coal-fired power plants abroad. One of the most closely watched is a proposed plant on the coast of Kenya, near the ancient island town of Lamu, a Unesco world heritage site.

The United States also plays a leading role in developing solar power. It is historically the largest emitter of greenhouse gases, though, and its investments in renewables went down slightly in 2017, according to the report, to $40.5 billion.

That decline coincides with President Trump's first year in office, a steady rollback in environmental protections and the announced pullout of the United States from the Paris climate agreement. Few countries are even close to meeting the targets they set under the Paris agreement, according to independent analyses.

European investment in renewables fell in 2017, according to the report, in large part, its authors said, because of Britain, which has moved to end subsidies for wind and solar projects.

That pointed to a looming challenge for the renewables industry: whether it can grow without government subsidies. "Many projects will have to sink or swim without any government-backed price support," the report said.

Renewables grew most significantly in 2017 where the demand for electricity also grew. The report found that developing economies accounted for 63 percent of global investment in renewable energy in 2017, up from 54 percent the year before. All told, 157 gigawatts of renewable power came online in 2017, more than double the 70 gigawatts generated from new fossil fuel sources.

The United Nations secretary general, António Guterres, has called climate change the biggest threat to humanity.