Crisis-hit auto giant Volkswagen said Friday it planned to cut 35,000 jobs by 2030 in Germany after reaching an agreement with unions on a drastic cost-cutting plan.

The deal, reached at the end of marathon negotiations with labour representatives, will save Europe’s largest carmaker around four billion euros ($4.2 billion) a year,  the German group said.

But the powerful IG Metall union hailed the agreement, which came just in time for Christmas and put an end to rolling strikes, as it avoided forced redundancies and plant closures.

Volkswagen had originally said it was considering shuttering production sites in Germany, which would have been an unprecedented move in the 87-year history of the carmaker.

The situation at the eponymous mass-market Volkswagen brand, which employs around 120,000 people in Germany, was “serious” and demanded urgent action, management argued.

VW has struggled with the transition to electric vehicles as it battles rising competition in China from local manufacturers, such as BYD and Geely.

The 10-brand group — which also owns Audi, Porsche and Skoda — has said it also has to contend with falling demand and elevated labour and production costs in Europe.

– Production moves –

“There will be no plant closures,” negotiator Thorsten Groeger from the IG Metall union told a press conference.

The agreement would however see production stop at Volkswagen’s smallest factory in Dresden at the end of 2025.

An “alternative overall concept” would be found for the site, which employs around 300 people, with Volkswagen’s continued involvement, unions said.

At VW’s plant in Osnabrueck, where some 2,300 people work, production would continue until mid-2027 before “other uses” for the site were found, the carmaker said.

Meanwhile, Volkswagen said it would also relocate the production of its popular Golf model from its flagship site in Wolfsburg, Germany, to a factory in Mexico.

All in all, the carmaker had “reduced the technical capacity at the German sites by over 700,000” vehicles, VW brand CEO Thomas Schaefer said at a press conference in Berlin.

The agreement with unions is “bringing development and labour costs to a competitive level”, Schaefer said.

“These are tough decisions, but also important decisions for the future”.

Of the planned four billion euros in savings, 1.5 billion would come from lower labour costs and a progressive reduction in the group’s headcount, Volkswagen said.

The deal foresaw a pay freeze for employees in 2025 and 2026, and the spreading of previously agreed bonuses over several years.

– German struggles –

Volkswagen’s perilous financial position was highlighted when it reported a 64 percent plunge in third-quarter profit to 1.58 billion euros in October.

The struggles at Volkswagen have been symbolic of a wider malaise in Europe’s biggest economy, which has been hit by high energy prices and is drifting towards its second straight year of contraction.

The risk that the crisis at one of Germany’s most iconic companies could lead to mass layoffs had drawn politicians into the debate ahead of early elections on February 23.

Berlin and the Lower Saxony state government, which holds 20 percent of the voting shares in Volkswagen, have leant on the group to find a solution.

Chancellor Olaf Scholz of the Social Democrats, who faces an uphill battle to hold on to his job in the election, warned recently that factory closures “would not be the right way”.

“Precisely because the bad decisions of management have contributed to the situation, that would not be ok,” said Scholz, whose party is trailing in the polls behind the conservative opposition.