Beijing's Forbidden City and Tiananmen Square in the Chinese capital, taken in 2008.
CNN  — 

The population of Beijing fell for the first time in two decades, state media reported Wednesday, amid ongoing efforts by the city’s government to drive out migrant workers.

Beijing’s population dropped by 0.1% in 2017, according to government figures, with 22,000 fewer permanent residents than the previous year.

In total, China’s capital has a population of 21.7 million people, more than London and New York combined.

Shanghai, also saw a small population drop in 2017 according to state media, falling by 13,700 to a total of 24.18 million.

It was the first time both city’s populations fell in the same year in four decades, state media reported.

The decline was attributed to “multiple factors” including a drop in China’s working age population and a slowing of migration from rural provinces.

Beijing’s municipal authorities have announced a target of capping the capital’s population at 23 million people by 2020, only 1.3 million more than currently live in the city, in a effort to improve living standards and reduce the strain on key services.

In late 2017, thousands of rural migrants were forced out of their homes in Beijing, as part of what municipal authorities described as a crackdown on unsafe and overcrowded housing.

The removal of the migrants followed a deadly fire in an industrial neighborhood in the south of the city, where 19 people died.

But critics accused the local government of using the fire as an excuse to push ahead with sweeping efforts to reduce the population by targeting the city’s poorest, most vulnerable communities.

China has strict laws regulating internal migration. Under a system of household registration, or hukou, citizens are prevented from accessing key government services, including education and health care beyond a set designated location.

Beijing’s population has grown by more than 10 million people in the past two decades. The last time the Chinese capital’s growth fell was in 1997, according to the Beijing Municipal Bureau of Statistics.

Shanghai city officials have instigated a similar growth reduction target, in a bid to maintain the city’s population below 25 million people.