There is a sense of shame as Luigi Plasmati, 89, recollects growing up amid chronic poverty in a crammed cave in Matera, an ancient, bruised city in Italy’s southern Basilicata region.

“It was brutal,” he said. “There were families of maybe nine or 10 children, sleeping next to mules and pigs. We were dying of hunger.”

Less than 70 years ago some 15,000 people, mostly peasants and farmers, were still living in grottoes carved out of limestone that dated back to Matera’s prehistoric era: dank dwellings with no natural light, ventilation, running water or electricity. Disease, particularly malaria, cholera and typhoid, was rampant. Bed space was scarce, with children squeezed with their parents into bunks that were deliberately built with space beneath for chickens. Coveted animals were kept indoors in case they were stolen. Large families would gather around a small table once a day to share a simple meal of bread with pasta or pulses.

The child mortality rate was high and Plasmati lost one of his five siblings. Those who survived grew up illiterate.

“I was working from the age of six, going out early in the morning to cut grain in the fields,” he said. “You’d try to sell the odd cigarette here and there to make some money, but there was never any money to spend.”

In the most extraordinary way, that history of squalor and poverty is now proving to be the making of Matera in the 21st century. A report last week by the University of Siena said that more than 25% of Matera’s housing stock is available to rent on Airbnb, more than anywhere else in Italy.

On top of enjoying a remarkable tourist boom, Matera will also be 2019’s European capital of culture. The impoverished cave dwellings of the Sassi – literally “the stones” – are providing the economic platform for a more prosperous future.

“Airbnbs, bars, restaurants … this is the natural evolution of the Sassi right now,” said Nicola Taddonio, a local tour guide. “These changes have helped connect people back to the Sassi. Even though we lost that connection for some time, our souls are back there.”

The Sassi limestone cave dwellings in Matera. Photograph: Tony Gentile/Reuters

The extent of the squalid conditions in the Sassi only came to international attention when writer Carlo Levi was exiled by Benito Mussolini’s fascist regime to a town close to Matera in 1935. In his book, Christ Stopped at Eboli, published in 1945, Levi described the horror he witnessed – the paltry furniture, children either naked or in rags, bodies ravaged by disease – and concluded: “I have never seen in all my life such a picture of poverty.”

It took a visit in 1950 from the Italian prime minister Alcide De Gasperi, who lambasted the slums as “a national disgrace”, to propel the government to take drastic steps that set in motion a chain of events which was to have a swift and dramatic impact on the city and peoples’ lives.

With money pouring in from the postwar Marshall plan, Gasperi put together what was initially considered an ill-conceived plan to evacuate all the inhabitants and move them to newly built homes in the outer areas of the Sassi. However, many residents struggled to adapt to their new homes – it was the first time many had seen water running from a tap, let alone a boiler.

The Sassi are the most significant aspect of this city. You imagine how generations of people lived Enzo Acito, Matera's head of tourism

“Some people were OK with it but most weren’t,” said Taddonio. “It was the moment the connection with the Sassi was lost. They didn’t know where to put their mules, and after so long living in such close proximity to other families, a certain level of solidarity was lost.”

But the period also marked the beginning of an evolution that over the following decades saw the Sassi host artists, hippies and major film productions, and eventually become a Unesco world heritage site.

Initially the ancient settlement lay abandoned for years, until a competition was held to decide what to do with it. Haunted by memories, many of the former inhabitants wanted it to be eradicated. “My parents hated the Sassi, they wanted concrete to be poured over them,” said Enzo Acito, Matera’s tourism chief.

But the younger generation, in awe of the dwellings perched on the edge of a steep ravine, saw an opportunity. The winning idea was to bring the caves back to life, and in 1986 a law was passed to move people back in. But having now grown used to their new homes, most of the former inhabitants refused to go. “There was a lack of services, like grocery shops and chemists, so to live there was very uncomfortable,” said Taddonio.

Inside one of the refurbished cave dwellings. Photograph: Atlantide Phototravel/Getty Images

The government encouraged the Sassi’s revival by subsidising restoration work. Artisans moved in, setting up workshops, while bars, restaurants and boutique hotels started to spring up. The Unesco designation in 1993 and the filming there of The Passion of the Christ, starring Mel Gibson in 2004, helped to put Matera on the map, but tourism only really took off after 2014, when the city won its bid to become the European capital of culture for 2019.

“There was a change in the economy, families started to use their homes as B&Bs and holiday lets,” said Acito.

The Airbnb phenomenon is currently the subject of fierce controversy in Italy, criticised for a “Disneyfication” effect on Italian cities such as Florence and Venice. Locals have complained about being pushed out and say the souls of historic centres are being threatened.

But people in Matera beg to differ. The Sassi still lack basic amenities, such as a supermarket, so there is little demand from locals to live there, and the holiday lets have helped plug a shortage in hotel beds, especially during the low season, Acito said. And while Matera now draws in some 600,000 visitors a year, it hasn’t yet suffered the same stampede inflicted on the more traditional Italian hotspots. Acito is determined it remains that way.

“We don’t want to be like Venice and Florence. We want to keep the number of tourists sustainable, but [maintain] good quality.”

He also has visions of Matera becoming a hi-tech hub as part of the next phase of its startling evolution. It is one of five Italian cities conducting tests for a 5G mobile network as part of an EU programme. The aim of the digital transformation is to attract companies working in the field of research and innovation.

But high-speed broadband aside, Acito points to the Sassi as being the main lure.

“The Sassi are the most significant aspect of this city,” he said. “Whether you stay for a few days or live there, you feel an emotion. You imagine how generations of people lived. We would offer people the space to work, but most of all, the conditions to be creative.”