CHEAP but dirty now, clean and still affordable sometime in the future. That used to be the coal industry’s pitch. But changing public moods about pollution, and stubbornly costly new technology, are denting the coalmen’s mood.

The biggest surprise is the slowdown in consumption in China, which burns half the world’s coal. Last year’s fall in demand no longer looks like a blip. In the first four months of 2015 it fell 8% year-on-year (and imports dropped by a stonking 38%). Environmental worries are spurring China to increase energy efficiency and boost its use of natural gas and renewables, particularly wind power. The economic slowdown has especially hit demand for the higher-quality (and more profitable) coal used in steelmaking.

Another big blow to the coal industry comes from cheap natural gas in North America. This is by far the cheapest fuel for power generation. Between early last year and the end of next year, coal-fired stations equivalent to more than a tenth of America’s power-generating capacity will close or be switched to gas.

European coal consumption is dropping too: In the European Union it fell by 4.7% overall, and in electricity generation by 4.2%, between 2008 and 2013, according to Carbon Tracker, a think-tank.

Investors are taking fright. The market capitalisation of America’s four largest coal companies is now $1.2 billion, down from $22 billion in 2010. Restructuring looms. One big, lossmaking producer, Arch Coal, faces delisting from the New York Stock Exchange, after its share price fell to below $1—down by more than 80% in a year. Norway’s huge ($900 billion) sovereign-wealth fund is getting out of coal. Other investors, most recently Bank of America, are also categorising coal as too risky. Unlike shares in oil majors like ExxonMobil and Chevron, coal is not a must-hold stock for investors. Coal miners are mostly more thinly capitalised than other energy firms, and thus more vulnerable to divestment campaigns aimed at cutting off fossil-fuel producers’ access to capital markets.

Environmentalists rejoice at this. Coal mining squanders water, and burning the black stuff emits poisonous mercury plus lung-choking acids and soot. It is the most carbon-intensive type of fossil fuel.

In theory, clean-coal technology (which burns pulverised coal at a high temperature, scrubs the emissions and stores the carbon) could give the industry a lifeline. But the prospects for that are dimming. On current form, the technology raises the cost of coal-powered electricity generation by up to 80%, and cuts efficiency by 30%. A clean-coal project in Mississippi (at $6.2 billion the costliest fossil-fuel plant ever built) is so over budget and behind schedule that a big investor, the South Mississippi Electric Power Association, has pulled out.

Coal may be unpopular, but it is not doomed. Its share of world primary-energy use is falling from a peak of 30% in 2010, but only to a likely 25% in 2035, according to BP’s annual energy forecast. For poor countries which prize growth over greenery, coal seems indispensable: cheap, abundant and reliable. India in particular is betting heavily on it.