In an era where every country in the world—apart from the US, Syria, and Nicaragua—is bound by commitments to reduce greenhouse-gas emissions, it should be little surprise that the demand for coal is falling fast.

Despite these global trends, US coal is looking for ways to revive its dying industry. One idea is to change its product: instead of mining coal to burn as a source of fuel, it could mine coal for crucial metals found in it.

Coal is the dirtiest fossil fuel. Not only does it produce the most amount of carbon dioxide pollution for each unit of energy, it contains non-hydrocarbon chemicals that, when burned, release dangerous toxins into the air. These include a strategically important group called “rare-earth metals.”

These metals, such as neodymium and scandium, are used in everything from smartphones to wind turbines. They’re also used in guided missiles and other defense applications. That is what makes them a strategically important resource, and for the last decade or more, China is responsible for the production of over 90% of global rare-earth metals. If China were to change its mind about supplying to the US, it would make the US more vulnerable to outside threats.

Rare earths is a misnomer, because they are neither “rare” nor “earths.” They are rare in their pure forms, but plentiful as compounds. They are called “earth metals” because that used to be the term for metals that can dissolve in acid. China’s monopoly on mining rare earths is purely due to the country’s ability to produce them at a cost that’s hard to beat (which is most likely because it doesn’t pay for avoiding the environmental impacts from the mining.)

China has in the past used its position as the world’s source of rare-earth metals for political maneuvering. In 2010, China blocked exports of rare-earth metals to Japan over a maritime dispute. That caused a steep rise in rare-earth prices globally and showed the dangers of monopoly over critical elements. After the dispute was settled, China resumed exports. But Japan was nonetheless forced to diversify its supply of rare-earth metals to avoid such a situation again.

In the US there’s only one rare-earth mine, in California—and it was shut down in 2016 after the mining company Molycorp filed for bankruptcy. There are, however, many coal mines.

There are three known ways coal could be a source of rare-earth metals:

Burning away hydrocarbons in coal leaves behind ash that is rich in metals, which can be extracted using chemical processes. Metal-rich parts of the total rock removed from the earth during coal mining can be manually separated out. Acid mine drainage can selectively remove rare-earth metals from coal. The process can occur naturally in mines that are rich in sulfur (which many coal mines tend to be) when water leaches out through the mines into rivers. If captured, the seepage can then be processed to separate metals.

But right now none of these techniques are economically feasible. In 2015, the US energy department set aside $20 million for projects to figure out how to lower the cost of recovering rare-earth metals from coal. Since then, the scientific community has already made some progress towards that goal. Even the National Coal Council, which advises energy secretary Rick Perry, is looking for “new markets for coal” and will be looking at rare-earth elements, according to the Washington Examiner.

There’s one other way to overcome the financial hurdle. With US president Donald Trump calling for both the revival of the coal industry and increased defense spending, some legislators have spotted an opportunity that combines both. In March this year, congressman Duncan Hunter, a Republican representative from California, introduced the METALS (Materials Essential to American Leadership and Security) act. “The US must no longer be wholly dependent on foreign sources of strategic and critical materials,” said Hunter at the time. “The risk of this dependence on national security is too great and it urgently demands that we reestablish our depleted domestic industrial base.”

The House of Representatives has yet to vote on the bill, but if it were to pass, it would make rare-earth metals a strategic resource, and therefore make it so that efforts to secure them are no longer subject to the kind of financial constraints they face now. That could reinvigorate rare-earth mining in California and elsewhere in the US—there are deposits in other parts of the country, too.

It could also revitalize the US coal industry, and further fuel the efforts to perfect methods to extract rare-earth metals from coal.