Germany's Cabinet has approved a plan to spend up to 40 billion euros ($44.4 billion) by 2038 to cushion the impact on coal-mining regions of abandoning the fossil fuel.

Economy Minister Peter Altmaier said Wednesday that funds will start flowing once parliament has passed legislation setting out the dates and terms of Germany's exit from coal, likely in the coming months.

In January, a government-appointed panel recommended Germany stop burning coal to generate electricity by 2038 at the latest, as part of efforts to curb climate change. Germany gets more than a third of its electricity from burning coal, generating large amounts of greenhouse gases that contribute to global warming.

The Cabinet decision came just ahead of state elections in two eastern German regions where lignite coal is mined.