Germany’s government has reached agreement with regional leaders on the closure of coal-fired power stations.

The agreement sets 2038 as a deadline for ending the use of coal and outlines a compensation package of around €40 billion for coal-dependent regions. The ed date for burning lignite could be brought forward to 2035, according to the Federal Ministry of Economics.

The decommissioning plan outlines the closure of 2.8 GW of capacity across eight sites in Rheinland by the end of 2022, and a further 4.4 GW at 11 sites in Rheinland and Lausitz by 2030.

A final 8.65 GW will be shuttered by the end of 2038.

Economic Minister Peter Altmaier called the deal a “breakthrough” for the country. “The decommissioning path is united and the framework for compensation is also in place. We will thus be able to plan the era of coal-based electricity generation in a way that is economically sensible,” Altmaier said.

The €40 billion compensation package will target four German states which have lignite mines and coal-fired power plants: Saxony-Anhalt, Saxony, North Rhine-Westphalia and Brandenburg.

Much of the money will go into new infrastructure projects for coal-dependent areas and retraining workers for new jobs. Mines and energy companies will also be compensated for lost production.

The government will draft a law in January and is aiming to get it passed later this year.