BERLIN — If there’s one factor that could be described as the key to Angela Merkel’s longevity as German chancellor, it’s the economy.

German output has expanded in all but one of her 14 years in office, stuttering only during the financial crisis of 2009. Though growth has been modest, averaging about 1.6 percent during her tenure, it's been fairly steady, ensuring Germans have the stability they crave. Some economists even refer to the Merkel years as a “golden” era for Europe's largest economy.

But now, just as Merkel enters the final stages of her chancellorship, her Midas touch appears to be fading. News last week that the German economy had contracted in the second quarter of the year sparked fears of a looming recession. If that happens, the effects would be felt far beyond Germany’s borders, with the impact rippling across the Continent.

Despite loud calls from industry for government stimulus to boost the economy, Merkel’s government has so far taken a wait-and-see approach. Finance Minister Olaf Scholz said this week that the government is prepared to spend as much as €50 billion to “counter a crisis with full force.” The coalition also agreed to all but scrap the so-called solidarity tax, imposed in the 1990s to help rebuild former East Germany, a step many hope will give the economy a much-needed jolt.

Germany’s problems are also homemade and, many economists argue, the result of Merkel’s decision to leave the economy on cruise control for years.

What’s missing though is a longer-term vision to put the economy back on track, economists say.

“I don’t see a clear and convincing strategy,” said Carsten Brzeski, chief Germany economist at ING. “It’s not the case that they’re doing nothing, it’s just not enough.”

Germany isn’t alone in facing economic headwinds. As world leaders gather for the Group of Seven summit at the weekend in Biarritz, France, the dimming global economic outlook is expected to top the agenda.

Most economists and policymakers blame Donald Trump’s trade war with China and Europe, along with Brexit, for endangering the longest economic expansion in recent memory.

Yet Germany’s problems are also homemade and, many economists argue, the result of Merkel’s decision to leave the economy on cruise control for years instead of pushing through reforms that could have helped it weather the tough times ahead.

Depending on how deep the German downturn ends up being, the political ramifications could be considerable, particularly for Merkel’s Christian Democrats. The party, which has been in power under Merkel’s leadership since 2005, will inevitably be blamed for the weakness, especially if unemployment begins to rise. That could open the door to rivals, especially the Greens, who recently pulled neck-and-neck with the Christian Democrats in some national polls.

Though the German job market remains robust overall — at 5 percent, the German unemployment rate is one of Europe’s lowest — signs of softness have begun to appear. Major German companies, including Deutsche Bank and chemical giant BASF, have announced thousands of job cuts in recent weeks and more firms are taking advantage of Kurzarbeit, a government-funded program introduced during the financial crisis that allows companies to reduce workers’ hours.

“I’m an optimist by nature, but I’m still worried about Germany as a place to do business,” BASF Chief Executive Martin Brudermüller told Handelsblatt in an interview Sunday.

Brudermüller, whose company issued a profit warning last month, said Germany needs a new “Agenda 2010,” a reference to a package of welfare and labor market reforms introduced under Chancellor Gerhard Schröder in 2003. Though many blame the social spending cuts that ensued for Schröder’s political demise, the Agenda 2010 is credited with resuscitating the economy, transforming the “sick man of Europe” into the Continent’s economic powerhouse.

No one benefited more from the reforms than Merkel. By the time the global financial crisis hit in 2008, the German economy was in such solid health that it recovered quickly, helped by the expansive monetary policy of the European Central Bank, the injection of government stimulus, and a surge in demand for German machinery and vehicles in China. The U.S. recovery further buoyed German exports, as Trump never tires of pointing out.

Indeed, since the financial crisis, Germany’s dependence on exports has only grown, leaving it with by far the world’s largest trade surplus. The value of its exports equals nearly half of the country’s $4 trillion GDP.

Thanks to years of underfunding, Germany’s once-vaunted public infrastructure, from bridges to telecommunications, is cracking.

As long as foreign demand for German goods remained robust, Germany’s export model was hard to beat.

Problem is, those days now look to be over. And unlike in 2009, neither the Chinese nor Americans are likely to come to the rescue as they grapple with their own slowdowns.

What’s more, the foundation of the German economy isn’t as solid as it was then. The German car industry, the lifeblood of the economy, has been hit by the double whammy of the Dieselgate scandal and the advent of electric vehicles, which German carmakers have been slow to embrace. German industry overall, which is still dominated by small and medium-sized companies, lags on another seminal shift: digitalization.

Germany’s ambitious shift to renewable sources of electricity production, known as the Energiewende, has proved to be another challenge for business, saddling companies with the most expensive electricity prices in Europe.

Meanwhile, thanks to years of underfunding, Germany’s once-vaunted public infrastructure, from bridges to telecommunications, is cracking.

The answer to the conundrum would be for the government to stimulate domestic demand through higher wages, tax cuts and investment, most foreign economists argue. After all, the country can afford it: Germany has recorded budget surpluses since 2013.

“There is no reason for Germany to return to being the sick man of Europe,” Simon Tilford, a prominent British economist, argued in an analysis this week. “The biggest challenge facing the country comes from its own politics rather than the worsening international environment.”

Despite the consensus among international economists that Germany has plenty of scope to stimulate its economy, the political reality in the country is that it will likely enter a deep economic downturn before such a step becomes palatable. The financial traumas of the 20th century have left Germans extremely wary of the government taking on too much debt.

In 2011, Merkel’s coalition passed a balanced budget amendment to the German constitution aimed at preventing the government from spending more than it takes in. Even the current negative interest rates on German debt — meaning the government can borrow money for free — hasn’t prompted a serious rethink of Germany’s fiscal policy.

Economists agree that even if the situation worsens, the German economy won’t fall off a cliff.

Paul Krugman, the Nobel Prize-winning economist, described Germany’s aversion to debt as ruinous obsession, in his New York Times column this week.

The underlying principle, known as the Schwarze Null, or “black zero” in German, was propagated for years by former Finance Minister Wolfgang Schäuble to become a shibboleth of contemporary German politics.

Such is the Schwarze Null’s power in the public mind, especially in the wake of the eurozone debt crisis, that even Schäuble’s Social Democratic successor, Olaf Scholz, has avoided questioning it.

Before long, he may have no choice.

If Trump decides to ratchet up the pressure on his trade war with Europe, the impact on Germany would be substantial because the U.S. is its largest market, accounting for nearly 9 percent of total exports. A no-deal Brexit would only compound those problems.

Economists agree that even if the situation worsens, the German economy won’t fall off a cliff. The concern is that without serious reform, it could enter a long period of stagnation, similar to what Japan has experienced since the 1990s, with low interest rates and weak growth.

By the time that becomes clear, however, Merkel will be long gone.

“She’s had great timing,” Brzeski said. “She arrived just as the economy was improving and now that she’s preparing to leave the outlook is turning.”