TOKYO — Japan’s population shrank by nearly a million during the last half-decade, official census figures confirmed on Friday, an unprecedented drop for a society not ravaged by war or other deadly crisis, and one that helps explain the country’s persistent economic woes.

It was the first time since Japan began collecting census data in 1920 that a nationwide count recorded a decline in the population, though surveys based on smaller samples have shown a downward trend for years.

The population stood at 127.1 million in 2015, the Ministry of Internal Affairs and Communications said, down by 947,000, or 0.7 percent, compared with the last census in 2010.

A shrinking population creates ripples that are felt from the economy to politics.

With one of the lowest birthrates in the world and little immigration, Japan has seen this milestone coming for years, if not decades. Yet efforts by the government to encourage women to have more children have had little effect, and there is little public support for opening the doors to mass immigration.