(Bloomberg) -- German factory orders unexpectedly rose in May, even as global momentum was affected by rampant inflation and uncertainty stoked by Russia’s war in Ukraine. 

Demand increased 0.1% compared to the previous month, compared to an economist estimate of 0.5%. The gain was driven by major orders and excluding those, orders fell 0.9%, according to a statement from the German statistics office on Wednesday. 

“The excess demand is likely to be due to the continuing acute shortage of intermediate products,” the statistics office said. “Enterprises still have difficulties completing their orders as supply chains are interrupted because of the war in Ukraine and distortions persist that have been caused by the Covid-19 crisis.”

Prospects for Europe’s largest economy have darkened as Russia cut down on gas deliveries, raising the risk of shortages in the coming winter. German Economy Minister Robert Habeck has stepped up warnings of impending turmoil, while the government is paving the way for rescues of energy companies reeling from surging prices. 

Business surveys by S&P Global revealed a deepening decline in demand for German goods in June, though manufacturers have been able to rely on an orders backlog built up while production was curtailed by supply snarls. 

Surging costs for imports like energy and food helped cause the first monthly German trade deficit since 1991, according to data published this week. Even if adjusted for price changes, foreign trade is expected to have a negative impact on growth due to global uncertainty.  

Overall activity has been supported by the loosening of pandemic restrictions and growing demand for services by consumers flush with savings. That momentum has also weakened however as prices for energy and a growing range of daily staples continue to surge. 

©2022 Bloomberg L.P.