Germany will become the first developed nation to totally banish coal from its energy mix and totally shift to renewables.

It's announced a deal with the coal industry to shut down all of its coal-fired power plants by 2038 at the latest. The federal German government will set aside $45.7 billion (Euro 40 billion) in aid to regions affected by the coal phase-out.

This historic decision reached after more than 20 hours of talks on Jan. 26 must now be implemented by the German government and 16 regional states. Renewables accounted for more than 40 percent of Germany's energy mix in 2018. It was the first time renewables had exceeded coal-generated energy as the top source of electricity for the country.

Its heavy reliance on coal as a major power source, however, means that Germany has failed to meet targets agreed to under the 2015 Paris climate agreement.

From now until 2023, coal plant operators will be asked to shut down about 12 gigawatts of capacity in a first step. This output is the equivalent to the power generated by 24 large power stations. Under the proposed plans, coal power capacity in Germany will be slashed by more than half to 17 GW by 2030.

The agreement is the federal government's second major intervention in Germany's energy market within a decade. The government first intervened in a landmark decision to shut down all nuclear power stations by 2022.

German Finance Minister Olaf Scholz praised the deal with the coal industry. He emphasized it is important for Germany to keep power prices stable while creating new jobs in coal-producing regions at the same time.

"If we all work hard and don't lose sight of the joint goal, then we can further develop Germany into a role model in energy politics," he said.

For his part, Ronald Pofalla, one of four leaders of the coal commission that negotiated the deal with the German states, described the agreement as "a historic accomplishment." He said the deal will allow Germany to meet its climate change targets for 2030 that mandate significant reductions in carbon emissions. The plan will also guarantee affordable and secure energy supplies.

The deal will ensure an economically viable future without coal for regions now heavily dependent on the mineral, which is abundant in Germany, said Armin Laschet, premier of North Rhine-Westphalia. This region is Germany's biggest coal-producing region and most populous state.

On the other hand, environmental groups want an even earlier exit from coal and promised to hold the federal government to account on attaining the deal's targets.

Business groups, while not totally sold on the exit from coal, welcomed the deal, however. One member of the coal commission described the deal "a compromise that hurts everyone. That's always a good sign."