BERLIN (AP) — Germany’s population has contracted slightly for the first time in nearly a decade because immigration shrank as a result of the coronavirus pandemic, official data showed Tuesday.

Some 83.1 million people lived in Germany at the end of June, with the population declining by 40,000, or 0.05%, in the year’s first half, according to the Federal Statistical Office.

The last decline was in the second half of 2010. Since then, the population had increased steadily — most sharply in the second half of 2015, when the influx of migrants to Europe caused an increase of 717,000 people.

The statistics office pointed to a sharp decline in net immigration starting in March, when the pandemic hit Europe, and lasting through May — a period that accounted for a population decline of 59,000. Most countries shut down public life and many, including Germany, largely shut their borders. In June, the country’s population grew by 4,000, still much lower than the 14,000 seen a year earlier.

Preliminary figures showed net immigration of 74,000 in the year’s first half, compared with 167,000 a year earlier. The number of deaths was 112,000 higher than the number of births, with the difference widening from 105,000 a year earlier.

The statistics office said delayed registration of new arrivals and departures because of office shutdowns may also play a part in the figures.