(Bloomberg) -- Germany’s ruling alliance sealed an agreement on a revised 2024 finance plan, pushing past internal divisions laid bare after a critical funding tool was struck down by the nation’s top court.

Following weeks of tensions triggered by last month’s judgment, Chancellor Olaf Scholz, Economy Minister Robert Habeck and Finance Minister Christian Lindner negotiated through the night to finalize a deal on plugging a €17 billion ($18.3 billion) hole in next year’s budget, according to government officials, who asked not to be identified in line with briefing rules.

Social Democrat Scholz, Habeck of the Greens and Free Democrat leader Lindner had been haggling over the details for days, raising questions about the viability of the three-party governing coalition and unsettling investors. They will hold a news conference explaining the specifics of the accord at 12 p.m. in Berlin.

The shock Nov. 15 judgment by Germany’s Constitutional Court upended the decades-old practice of using special pots to fund investments and called into question tens of billions of euros in debt-financed spending. The issue ballooned into a political crisis because the use of the funds was critical to bridging differences in the coalition and the foundation of their blueprint for government.

The dispute, which further dented the government’s already weak approval ratings, revolved around the so-called debt brake, which limits net new borrowing. The off-budget financing was a way to sidestep constitutional rules and still pay for projects like investment in the country’s climate transition.

The details of the new 2024 spending plan will be closely watched as all three parties sought to enforce their red lines in the talks. While the SPD and the Greens wanted to defend social programs and climate investment, the FDP insisted on not breeching the debt brake for a fifth consecutive year in 2024.

Following the ruling, the government was forced to overhaul its 2023 finance plan and again suspend the borrowing restrictions, while its original budget for next year, approved in cabinet in July, was halted as it made its way through parliament.

Scholz and his ministers then faced a delicate balancing act, as they had to draw up a new 2024 budget that complies with the court’s judgment without triggering additional legal challenges.

Scholz’s SPD and the Greens support lifting the debt brake again, saying it’s justified by expenses linked to the ongoing war on Ukraine, while Lindner’s fiscally hawkish FDP has pushed back strongly.

The debt restrictions were set aside starting in 2020 to help the government deal with the fallout from the Covid-19 pandemic and the energy crisis.

The chaos triggered by the budget ruling prompted a call from Bundesbank President Joachim Nagel for clarity.

Unresolved financing issues and government infighting on spending priorities “is always bad for financial markets,” Nagel, a member of the European Central Bank’s governing council, warned last month.

The turmoil has also unfolded at a time of sustained stagnation in Europe’s biggest economy. Economists have become more pessimistic about Germany’s outlook, according to Bloomberg’s monthly survey published Monday. They predict output will contract by 0.2% this quarter, double the 0.1% drop previously forecast.

“Growth will remain sluggish afterwards on the back of the budget dispute and a structural lack of workers,” Erik-Jan van Harn, an analyst at Rabobank.

What Bloomberg Economics Says...

“The country’s fiscal policy outlook has become much more uncertain. A raft of infrastructure and environmental projects might not receive funding now. This could reduce GDP growth by 0.5 ppt next year, jeopardizing the gradual recovery after the downturn in 2023, and adding considerable downside risk to our 2024 forecast.”

—Martin Ademmer, economist. Click here for full GERMANY INSIGHT

Following the court ruling, there have been renewed calls across the political divide for an overhaul of Germany’s borrowing rules to enable the massive investments needed for the transition to a less polluting and more technologically advanced economy.

Such a move would require a two—thirds majority in parliament and therefore the support of the main opposition conservatives, who filed the lawsuit challenging the government’s use of special funds.

Gita Gopinath, first deputy managing director of the International Monetary Fund, was quoted as saying last week that Germany’s debt brake could be “loosened moderately” by increasing the limit on new borrowing by one percentage point — the equivalent of about €40 billion — from the current level of 0.35% of gross domestic product.

“This would create financial leeway for the major investments that are needed now, such as for the green transformation or for transport infrastructure,” Gopinath said in an interview with weekly newspaper Die Zeit.

“At the same time, according to our calculations, the debt to GDP ratio would still fall in the medium term,” she added.

--With assistance from Harumi Ichikura and Christoph Rauwald.

(Updates with Bloomberg Economics comment)

©2023 Bloomberg L.P.