BILLINGS, Mont. (AP) — Coal companies in the United States boosted production of the fuel in 2017 to reverse a two-year decline.

The U.S. Energy Information Administration said Thursday that companies mined 771 million tons of coal through Dec. 30, a 6 percent increase versus 2016.

Wyoming, the largest coal state, saw production rise 8 percent. Neighboring Montana had a 5 percent increase.

Among other coal states, production rose 13 percent in West Virginia, 8 percent in Pennsylvania and 10 percent in Illinois. Kentucky's production was relatively flat.

Despite the increases, coal's long-term prospects remain shaky. Natural gas and renewables such as wind and solar have severely eroded coal's once-dominant role in U.S. electricity generation.

In the last week of 2017, the government says coal production fell 32 percent versus the previous week.