European powers are adopting urgent measures to tackle a stark demographic shift that is leaving some eastern and southern parts of the continent facing terminal decline.

While Boris Johnson seeks steep cuts in the number of unskilled workers arriving in Britain, a number of European nations including Spain, Germany and south-east European countries are desperately seeking to level up societies upended by emigration and ageing.

Germany is changing the law this week to make it easier for migrants from outside the EU to come to work, in an attempt to plug a yawning skills gap in an ageing labour market with more than 1m job vacancies.

Spain, meanwhile, is scrambling to reverse dramatic depopulation of its interior by promising improved digital connectivity and support for industrial hubs and startups.

The EU has for the first time appointed a commission vice president for demography, Dubravka Šuica, to address the unintended consequences of its free movement policy. She said she wanted to reverse the trend of young people abandoning home towns and countries, with plans including extra funds to boost local economies and free wifi in every EU village by 2024.

“I understand young people who want to create new skills, new friends and different ways of life in different countries,” she said, but she added that the trend must be reversed, otherwise some member states would not be sustainable because they would lack a labour force.

Eastern European countries have complained that brain drain is skewing the European project against them: Croatia’s prime minister recently demanded an EU-wide response, warning that depopulation threatened Croatia’s very survival.

Šuica said demographic imbalance was not only an east-west issue but also affected western countries as people quit small towns for city life.

A data analysis conducted by the Guardian, to coincide with the launch of a new series of European journalism, reveals the extent of Europe’s startling demographic shift and shows how profound economic changes and EU free movement are combining to reshape the continent’s map.

Q&A This is Europe: a new Guardian series Show Hide This is Europe is a new stream of Guardian journalism that investigates the big challenges that transcend national boundaries, and seeks out the solutions that could benefit us all. These are testing times, and crises are not limited by national borders. But then neither are we.

Photograph: Guardian Design

In the past five years, the number of 15- to 34-year-olds has fallen by more than 15% in a dozen European regions, all of them in eastern Europe.

Remarkably, 19 of the 20 European regions with the fewest young people are all in eastern Germany. In the region with the oldest population in Europe, Spree-Neisse, just one in seven people are in this age category.

Spain, northern Italy and central France are also struggling with youth “deserts”. One in six people in Spain’s Ourense region are in the 15-34 bracket, and the proportion is falling fast.

Young people are increasingly concentrating in Europe’s most prosperous cities. The changing demographic presents social and political risks, experts believe, as large numbers of educated young people are increasingly drawn away from provincial life to jobs in the big urban centres.

“You have had a lot of out-migration from places that were less economically successful and a clustering of younger people … in more successful regions of Europe. And so that is going to exacerbate social divides and it’s going to show up politically,” said John Springford, from the Centre for European Reform, who co-authored the The Big European Sort?, a 2019 report.

He singled out eastern Germany as an archetype, saying the demographic shift driven by the exodus of younger people was playing into the hands of rightwing populists such as Alternative für Deutschland (AfD).

“Because a constituency in the eastern Länder in Germany, for example … is going to tend to be older, more socially conservative and less educated, that means that that constituency is more likely to be willing to vote for the AfD,” Springford said.

Areas of the German economy experiencing shortages of skilled labour include IT, electronics engineering and, primarily, the health sector, where a rapidly ageing nation needs more doctors, pharmacists and care workers. The number of people aged over 80 in Germany is expected to rise by almost 50% between now and 2030.

Target countries the government believes to have a surplus of skilled workers with similar training standards and a “cultural proximity” to Germany include eastern European states such as Kosovo, Bosnia and Herzegovina and Ukraine, but also Mexico and the Philippines.

Under old rules, German employers that wanted to hire labour from outside the EU had to demonstrate that a worker’s skills were in short supply and that no local candidate was available. The new immigration act does away with such hurdles.

Facebook Twitter Pinterest The EU’s commissioner for demography, Dubravka Šuica, with Germany’s Europe minister, Michael Roth. Photograph: Thierry Monasse/Getty Images

Spain’s new government has made la España vaciada, or the hollowed-out Spain, a priority, creating a ministry for ecological transition and the demographic challenge.

“The solvency of the democratic system can’t afford to run the risk of people feeling like they’re second-class citizens,” said the new minister in charge, Teresa Ribera.

“There’s a sense of urban/rural grievance, but it also exists within and on the peripheries of urban areas. People who feel left behind are those who are most likely to look for false alternatives because they’ve lost trust in their institutions.”

Today, 90% of Spain’s population – about 42 million people – are stuffed into 1,500 towns and cities that occupy 30% of the land. The other 10% occupy the remaining 70%. Over the past decade, 80% of Spanish municipalities have experienced population falls.

Ribera said her department had a simple if ambitious aim: “We need to make sure whoever wants to stay in, or return to, a rural area should be able to do so without losing out on quality of life or services.”

Šuica said she hoped the next EU seven-year budget – currently subject to fierce political wrangling – would provide rural areas with funds to improve internet connectivity and bolster local economies.

A promise to provide free wifi to every village in the EU would be delivered “for sure” by 2024, she said, adding that it was “one of the most important pillars of the political guidelines of the commission”.

But her hopes to reverse the rural-to-urban brain drain in five years met with scepticism. “Five years sounds completely impossible,” said Niclas Poitiers, a research fellow at the Bruegel European thinktank. “I am not sure if she has the competences [policy powers] or the political weight necessary to do that.

“Who knows what will happen in the long run but I think the trends are that people move to cities and I don’t see how that could be stoppable. We have to think about how we manage that.”