President Trump, as he so often does, dominated the coal headlines in 2017. But America's bombastic leader had less to do with the major developments in the coal sector than the headlines would suggest.

After a dismal 2016, which saw U.S. coal production fall to the lowest level since 1978, America's miners had a lot to be happy about in 2017. Mine output was 719 million tons through the first 11 months of the year, an increase of 8 percent over last year.

The increase was driven by a bump in natural gas prices, especially over the first part of the year, and a red-hot export market, where a cutback in Chinese production coupled with increased industrial demand from India sent prices soaring. The 69 million tons shipped by American mines in the first three quarters of 2017 was more than in all of 2016, according to U.S. Energy Information Administration data.

"This has been a driver in the market and a savior for many coal companies," said Hans Daniels, who leads coal analytics firm Doyle Trading Consultants LLC. "There's an outlet for coal, and the prices are pretty high. They're making a good chunk of change from it."

Coal still faces a grim picture in the United States, however. Trump's election did little to stem the tide of power plant retirements, with utilities announcing plans to shutter 22 gigawatts of coal capacity in 2017, according to a tally compiled by the website Numerical. By comparison, American power companies closed down 51 GW of coal between 2012 and 2016.

Particularly worrying for the coal industry is the increasing presence of relatively new, bigger plants on the retirement list, as large facilities like JEA's St. Johns River Power Park, Luminant Generation Co. LLC's Sandow Power Plant and WEC Energy Group's Pleasant Prairie Power Plant all announced plans to close down.

The long-term trend was compounded by the weather. A mild winter and cool summer in parts of the country hampered overall power demand, putting a dent in power producers' bottom lines. Coal was not the only fuel to suffer, but domestic demand flagged as a result. Doyle Trading Consultants estimates that total U.S. coal demand will decline to 672 million tons in 2017, compared to 677 million tons last year.

A look back to 2008 consumption levels is even more startling for coal producers. Back then, U.S. demand was slightly more than 1 billion tons.

That trend is likely to continue, with more retirements of existing facilities and scant plans to build new ones in the United States, said James Stevenson, who tracks the sector at IHS Markit Ltd.

"In the end, increases in exports are not going to be as big as declines in domestic demand," Stevenson said.

Coal's year has not been completely independent of Trump. The administration's rollback of Obama-era climate regulations like the Clean Power Plan has helped stabilize demand, analysts said. A proposal by Energy Secretary Rick Perry to subsidize coal plants for storing fuel on-site would likely have a similar impact, they said, helping to prolong the lives of plants that might otherwise retire.

But until a utility commits to building a new coal plant, the long-term trends are unlikely to change as the industry continues to contract in the United States, analysts noted.

"Even if there is coal technology out there that can improve efficiency, it doesn't seem any utility has the risk appetite to expand or significantly upgrade their coal assets," Daniels said.

And so American coal producers are going into 2018 with foreign markets on their mind. Prices for coal deliveries in the Netherlands' Rotterdam next year are hovering around $90 a ton, roughly double what they were two years ago.

India's industrial sector, meanwhile, is hungry for high-sulfur coals found in northern Appalachia and the Illinois Basin. India's cement and brick producers turned to U.S. coal as a substitute after the country's Supreme Court imposed a ban on the use of petroleum coke in three states.

That has provided a foothold for U.S. producers in one of the world's fastest-growing coal markets. If India's demand for U.S. coal expands outside its industrial sector, "you're looking at a market that's hundreds of millions of tons instead of tens of millions," Stevenson said.

In the end, coal's lesson from 2017 may be that the industry doesn't need a friend in the White House as much as it needs allies abroad.