Take any road in Italy, look up, and you’ll see a lovely hilltop town: a campanile, a castello, a few newer buildings spilling down the slope, as if expelled for the crime of ugliness. But even amid this bounty there is something exceptional about Matera. It clings to a denuded peak in the extreme south of the country, in the Basilicata region—the instep of Italy’s boot. Travellers are often shocked by the starkness of Matera. It’s a claustrophobic outcropping of cave dwellings carved into limestone, like scrimshaw, with hardly a tree or a blade of grass to be seen. In the afternoon sun, Matera looks like a pile of tarnished gold thrown down by a careless giant. Its severe beauty is as much a tribute to human resilience as to the rugged landscape where it is situated. Most places in Italy encourage you to celebrate the prettiness that wealth bestows: exquisite iron grillwork, festive marble fountains. Matera is more visceral—a monument to endurance and thrift, to hard lives lived without waste.

Matera may look inhospitable, but people have been settling here for a long time: it is often cited as one of the oldest continuously inhabited cities in the world, in a league with Aleppo and Byblos. There is something inherently alluring about this natural fortress, which towers above fertile plains and the Gravina River. A cave near Matera contains the remains of a hundred-and-fifty-thousand-year-old hominid; another has tools and bones from ten thousand years ago, and dozens of Neolithic sites dot the surrounding ridges. Matera was already a significant settlement in the Bronze Age.

Because of Matera’s narrow confines, rebuilding has been constant, making the city a palimpsest in stone. A dig in 1906, near the Duomo, in the town center, went thirty-five feet below the surface and found Christian coffins and the remains of a Saracen invasion from around 800 A.D. The scientists kept going, and below that they discovered statues, broken columns, and money from the Byzantine occupation, of around 400 A.D. Farther down, they uncovered ancient Greek and Roman coins and, under that layer, bits of ceramics from three thousand years ago. Matera stands at what has long been a crossroads between East and West. As Anne Parmly Toxey points out in her comprehensive 2011 study, “Materan Contradictions,” Greeks, Romans, Longobards, Byzantines, Saracens, Swabians, Angevins, Aragonese, and Bourbons all passed through the town. Man came here and never left—that’s the local boast. Given this history, it is jarring to learn that fifty years ago the government tried to make Matera go extinct.

In the middle of the eighteenth century, Giuseppe Antonini, a baron from Salerno, praised Matera for its “highly cultivated” citizens and “its vast and extremely fertile countryside.” The Roman abbot Giovanni Battista Pacichelli, a contemporary of his, was likewise impressed. The town, Pacichelli noted, was divided into three sections, as it is today. The main section, the Civita, contains grand churches and picturesque palazzi; it is flanked on both sides by the Sassi, or the Rocks—steeply graded districts where mostly peasants lived. The pileup of the Sassi disconcerted Pacichelli: the roof of a house, he wrote, could well be the floor of a church, “confusing the places of the living and the dead.” But he, too, admired what was then a thriving ecclesiastical hub. The town was the seat of an archbishop and, at the time of Antonini’s and Pacichelli’s accounts, a regional capital. From Matera, Spanish occupiers oversaw part of the Italian peninsula, eventually giving way to the French.

Matera’s status began declining in 1806, when Joseph Bonaparte moved the seat of the region’s government to Potenza, sixty miles to the west. Over time, Matera became known as “the capital of peasant civilization.” Rulers came and went, but the locals endured in their cave homes, or grotte. Each morning, they descended long, narrow trails into the valley, and worked in fields that were often miles away. At dusk, they returned to the mountain. Much of the communal life of the town was lived outdoors, in small courtyards called vicinati.

Materans were tough and self-sufficient. They had their own rituals and songs, their own demons and dialect. Many of their traditions developed as ways of preventing waste. Using shared ovens, they produced a unique horn-shaped bread that was leavened and baked slowly, yielding large pores that helped it stay fresh for a week. Rainwater was captured by a complex network of stone basins and underground ceramic pipes. Resourceful as the Materans were, however, their life style increasingly lagged behind that of the rest of the world. The better-off citizens of Matera began departing for the Piano—a more recently settled, flatter section of the hilltop—and the townspeople who remained in the Sassi were almost exclusively poor. In the caves, plumbing, electricity, and telephones were practically nonexistent. And until the nineteen-thirties you couldn’t take a wagon drawn by a donkey into the Sassi, only a hand-pulled cart.

Within Italy, Matera came to be seen as just another out-of-the-way town in the impoverished south; among foreigners, it had a reputation as a picturesque troglodytic locale. But, as the world modernized, curiosity gave way to repulsion. It seemed grotesque for people to live in lightless dwellings alongside their animals. In 1853, John Murray’s “Handbook for Travellers in Southern Italy” declared Matera “a dirty city” and noted that “its lower classes are said to be the most uncivilized in the whole province of Basilicata.” Its problems seemed intractable: poor sanitation, brutal work conditions, malaria. Yet the population continued to grow, reaching fifteen thousand by the early twentieth century. Half a dozen family members often crowded into a cave; residents used basins for toilets and burned the waste on the cliffs. Italy was falling behind the other nations of Europe, Basilicata was falling behind Italy, and Matera seemed to be last of all.

In 1902, Prime Minister Giuseppe Zanardelli visited the Sassi and reported that it awoke in him “not just amazement but deep pity.” He proposed new railways, which weren’t completed, and land redistribution, which didn’t happen. In 1926, the archeologist and social activist Umberto Zanotti Bianco called Matera “a Dantean horror.”

By this time, the Fascists were in power, and Benito Mussolini was determined to bring his humiliated country up to date. Matera was an obvious candidate for modernization. He connected the town to the Apulian aqueduct, providing the Sassi with running water, but the Fascists were stymied by the prospect of overhauling the caves. One solution, they decided, was to depopulate the Sassi and transfer the residents to houses near their fields.

Mussolini was ousted in 1943, and, paradoxically, it was one of his opponents, the leftist Carlo Levi, who fulfilled the Fascist agenda for Matera. Levi, a doctor and a painter from Turin’s upper class, had been arrested for anti-Fascist activities in 1935 and exiled to Aliano, south of Matera. He spent a year there, amid poverty that he would not have seen otherwise. In his 1945 autobiographical novel, “Christ Stopped at Eboli,” he described the peasants of Italy’s extreme south as living “in a world that rolls on independent of their will, where man is in no way separate from his sun, his beast, his malaria.” During his exile, Levi visited Matera only briefly, but his sister, also a doctor, passed through on her way to see him, and his book incorporated her observations of children “sitting on the doorsteps, in the dirt, while the sun beat down on them, with their eyes half-closed and their eyelids red and swollen” from trachoma. She described boys and girls trailing her down a path, begging for quinine.