A licence for the extraction of fossil fuels in Wales has been refused by the Welsh Government for the first time.
Coal mining at an opencast site in the Dulais Valley is to end after ministers refused to allow the site to continue to operate because of climate change.
The 850-acre Nant Helen site employs 110 people, with 50 working at the adjacent washery.
Celtic Energy, the mine's operator, said it was "shocked" by the decision.
Continuing to extract coal from the site would have "environmental and climate change impacts", a Welsh Government spokeswoman said.
The site in Coelbren, on the border of Neath Port Talbot and Powys, includes the adjacent Onllwyn washery and distribution centre which now only serves the Nant Helen operation.
The company said a significant number of employees will be required for the restoration of the area, which is due to be the location for a train testing facility announced by the Welsh Government.
Officials at the Coal Authority had issued a licence to 31 December 2021, and Powys council had granted planning permission.
But Environment Minister Lesley Griffiths' decision means Celtic Energy does not have the necessary licence for mining operations at Nant Helen.
Coal licences are handed out by the Coal Authority - a UK government body - but the licence is only valid if it has the approval of a Welsh Government minister.
It is one of a set of powers over fossil fuels in Wales that came into force in April 2018.
A Welsh Government spokeswoman said it is "proactively supporting a constructive transition away from coal extraction and use, ensuring areas where coal is currently being extracted are restored to a high standard.
"Continuing coal extraction from Nant Helen would have inevitable environmental and climate change impacts.
"Refusing to authorise the licence extension ensures the coal remains in the ground and it will not contribute to global climate change, which is in the best interest of the people of Wales."
The spokeswoman added that Ms Griffiths would like the Coal Authority to "develop a solution" that would give "prompt effect to her decision", ending extraction of coal in a way which "minimises environmental impacts".
Nant Helen was mothballed in October 2016 before re-opening in January 2019.
Will Watson, Chief Executive Officer of Celtic Energy, told BBC Wales "we were shocked to receive a letter from the Coal Authority advising us of the minister's decision to refuse authorisation for an extension of the coaling licence at Nant Helen.
"We are now working with the Coal Authority and local authorities to consider options, in light of the minister's decision, for a way forward which minimises the environmental impacts and delivers the best long term outcome for the site, surrounding communities, our employees and Wales as a whole."
The Welsh Government had already said it would refuse coal applications under its powers, although this is the first time it has refused to authorise a Coal Authority licence for commercial coal mining.
Paul Frammingham, Chief Finance and Information Officer at the Coal Authority, confirmed the refusal, adding: "We are working with the operator, Powys and Neath Port Talbot County Councils and Natural Resources Wales to agree a plan."
The Nant Helen opencast mine, along with the coal washery next door at Onllwyn, is the preferred site for a £100m train testing site announced by the Welsh Government in 2018.
Currently manufacturers have to send trains across Europe for testing before they come back to the UK for service.
The Welsh Government confirmed it will submit the planning application for the Global Centre of Rail Excellence this summer.
Celtic Energy CEO Will Watson said that a "significant number of employees will be required for the restoration phase" of the Nant Helen opencast site "and that will hopefully coincide with, or be followed by, work on the Global Centre of Rail Excellence project.
"Our hope is that we can keep perhaps two thirds of the workforce for a considerable time".