Cheap energy matters most to poor people, and the coal industry's hopes have rested on emerging economies to fuel their modernization.

But growing energy efficiency, rising pollution worries and stiffer competition from other fuels mean that in most countries the tide is turning against coal. Prices have been sliding, political opposition growing and demand drooping. The Dow Jones Total Coal Market index has fallen 76 percent in the past five years.

High-cost deep mines in the rich world are hit the hardest. In the U.S., 24 coal companies have gone bust in the past three years, and one-sixth of the remaining capacity loses money. But even Australia, whose low-cost opencast mines play a role akin to Saudi Arabia's in the oil market, is jittery.

Stoking the gloom is China, once the strongest market. It is still the world's biggest coal consumer, accounting for four-fifths of global demand growth since 2000. But Chinese consumption dipped by 1.6 percent in 2014, despite economic growth of 7.3%. The country's voracious appetite for steel is peaking, damping demand for coking coal.

Worries about pollution mean that demand for thermal coal, as used in power stations, is slackening too. Water conservation is another concern for policymakers — on current trends coal could account for a quarter of China's water use by 2020 and coal reserves are mainly in the most parched regions. Its coal-fired plants are running at only 54 percent of capacity, a 35-year low. In Beijing two big coal-fired plants closed in recent days; the capital's last one will shut down next year.

Another prop to demand has been power generation in rich countries. But in America, coal now struggles to compete with natural gas, which has fallen by 80 percent in price since 2008. Domestic coal use there peaked in 2007. European consumption soared after Germany's hasty decision to close its nuclear-power plants. But gas and renewables are eating into that.

Coalswarm, an environmental think tank, says in a new report that two-thirds of coal-fired power plants proposed worldwide since 2010 have been stalled or canceled. The growth rate in coal-fired generating capacity is slowing, down from 6.9 percent in 2010 to 2.7 percent in 2013. In 2014 the world added more generation from wind-power than coal. Overall, Europe and America have already cut coal-fired generation capacity by over a fifth in a decade.

Political pressure is growing against the most carbon-intensive fossil fuel. Coal provides 40 percent of the world's electricity. But of global capacity, 75 percent is of the dirtiest kind, which burns coal at low temperatures and emits 75 percent more carbon dioxide than the most advanced "ultra-supercritical" plants, which burn powdered coal at high temperatures. The chimneys of all but the most modern coal plants also emit plenty of other nasties.

Overall, coal kills about 800,000 people a year, most of them poor. In China, it is responsible for up to a sixth of the particulates most dangerous for human health.

Germany is introducing new carbon dioxide curbs to force the closure of its dirtiest coal plants. In America, the coal and electric-utility industries are fighting the Environmental Protection Agency's attempts to curb emissions of carbon dioxide, mercury and other toxins contained in coal. On March 25, the Supreme Court heard arguments by some states, backed by the miners and utilities, that the agency has failed to duly consider the cost of its measures against mercury.

Campaigners reckon 80 percent of the world's coal reserves must stay in the ground if the planet is to stand a chance of keeping global warming under 2 degrees Celsius by 2050. A divestment movement akin to the apartheid-era campaign to boycott South Africa is underway in many universities. Stanford may dump its coal investments and Oxford University is under pressure to do likewise.

The horizon is not wholly bleak for coalmen. Clean-coal technology can abate the worst pollution, at a cost. Schemes for capturing power stations' carbon dioxide emissions may one day prove economic, countering coal's reputation as a planet-cooker.

In some emerging markets, India especially, demand for coal is set to continue rising — so overall global demand may not peak until at least the 2030s.

Even though some other developing nations' coal imports will grow in future, coal companies are having to face up to a crisis now. Some are cutting costs and getting ready for a wave of consolidation. Others are litigating and lobbying against change.

The biggest danger for the coal miners is that capital ceases to flow their way. Investors can cope with a cyclical business, but the fear now is of a structural shift, in which China follows the rich world in beginning to phase out coal, India increasingly produces its own and a plentiful supply of cheap gas keeps prices low everywhere.

Copyright 2013 The Economist Newspaper Limited, London. All Rights Reserved. Reprinted with permission.