(Bloomberg) -- Germany’s ruling coalition sealed a delayed agreement on a €481 billion ($521 billion) budget for next year and new measures to boost the economy, ending weeks of wrangling that had raised questions about the three-party alliance’s ability to govern.

Social Democrat Chancellor Olaf Scholz, Economy Minister Robert Habeck of the Greens and Free Democrat Finance Minister Christian Lindner cemented the accord during a latest round of talks that began on Thursday and dragged into Friday morning. The draft finance plan now faces a bruising passage through parliament, with some coalition members still deeply unhappy with the cuts forced on them by the fiscally hawkish Lindner.

Scholz insisted that the budget compromise will strengthen the government at a time of uncertainty fueled by Russia’s war on Ukraine, anxiety around climate change and the rise of extremist forces across Europe. Priorities in the spending plan included internal and external security, social cohesion, tax relief for citizens and companies, climate protection and economic growth, he said at a news conference alongside Habeck and Lindner.

“I am pleased that we have managed put together a budget that provides the right answers to the questions of our time,” Scholz said.

The chancellor and his ministers had been under pressure to demonstrate the coalition is still viable after a disastrous performance in last month’s European Parliament elections. That prompted the main opposition conservatives, who have a healthy lead in opinion polls, to demand that the next national vote due in the fall of 2025 be held right away.

The ruling parties are also heading for another drubbing in September in three regional elections in eastern Germany, where polls show the far-right Alternative for Germany is the strongest force.

Negotiations on the latest financing blueprint were complicated by Lindner’s insistence on restoring a strict limit on net new borrowing this year that was suspended to help deal with the pandemic and the energy crisis.

The FDP leader forced belt tightening on all of this cabinet colleagues except Defense Minister Boris Pistorius, who will get enough cash to ensure Germany continues to meet NATO’s goal of spending 2% of gross domestic product on the military.

The draft budget foresees investments of around €100 billion and net new borrowing of €44 billion, in line with the constitutional limit known as the debt brake, Lindner said. The figure for new borrowing compares with about €51 billion this year, including an additional €11 billion in a supplementary budget, he added.

Habeck said the growth package — which comes on top of a similar set of measures enacted earlier this year — could add 0.5 percentage points to Germany’s anemic rate of expansion.

It includes measures designed to strengthen private and public investment and speed expansion of renewable energies, additional tax write-offs for companies and incentives for people to work longer. The government will also extend tax relief on electricity costs for manufacturers and step up efforts to cut red tape.

Scholz had initially wanted to get the 2025 budget approved in cabinet on Wednesday, but that was pushed back as ministers argued over limited funds. They’re now set to sign off on the plan on July 17.

The Greens were especially irritated by the cuts made necessary by Lindner’s insistence on restoring the debt brake.

Foreign Minister Annalena Baerbock held out until the very last minute and only agreed to the budget early Friday in order to prevent the coalition from splitting apart, according to a person familiar with her thinking.

The budget agreement contains a clause that guarantees additional flexibility in the case of an unexpected international crisis, added the person, who asked not to be identified discussing confidential deliberations.

Rolf Muetzenich, the head of the Social Democrat caucus in the lower house of parliament, said Friday the option of suspending the debt brake remains on the table, though Lindner again ruled that out.

Once it has been endorsed by the cabinet, the draft budget will be sent to parliament for scrutiny by lawmakers. It would then be expected to win approval in both the lower house, or Bundestag, and the Bundesrat upper house, where the 16 regions are represented, by the end of the year.

--With assistance from Arne Delfs and Chris Reiter.

(Updates with details, comments throughout)

©2024 Bloomberg L.P.