Germany's manufacturing sector contracted at the fastest rate in three years in May and output fell for the first time in four months, a survey showed on Thursday.

The HCOB final Purchasing Managers' Index (PMI) for manufacturing, which accounts for about a fifth of Germany's economy, fell to 43.2 from 44.5 in April, the fourth consecutive monthly decline and the lowest reading since 2020.

The manufacturing PMI has been below the 50 level that separates growth from contraction since July 2022.

Goods producers in the euro zone's biggest economy faced a sharp drop in new orders during May, the report said. The downturn in demand fed through to production, which contracted for the first time in four months.

"The manufacturing sector is heading towards difficult times," said Cyrus de la Rubia, chief economist at Hamburg Commercial Bank AG.

Companies noted declining demand, particularly in exports to China, Europe and the United States.

Manufacturers' expectations towards future output turned pessimistic.

However, "companies are continuing to increase employment and they are still able to push through slightly higher selling prices in an environment of significantly falling input prices, which is a good thing for profit margins," de la Rubia said. (Reporting by Maria Martinez; editing by John Stonestreet)