I first met Abdel Kader Haidara in happier times. It was five years ago, and I had come to see his family collection of ancient manuscripts, which were stored in a grand house midway down one of Timbuktu’s sand-blown roads. Inside, researchers and archivists were working to organize, digitize, and display some of the 45,000 manuscripts Haidara and his family had collected and safeguarded for generations.

In his office, Haidara, a forty-three-year-old man dressed in purple robes, with a pistachio-colored turban loosely coiled around his head and chin, was surrounded by boxes of manuscripts and bound sheaves of curling papers. He graciously agreed to show me some of the most prized documents in the Mamma Haidara Manuscripts Library. From his desk, he selected a small leather-bound book bursting with crumbling pages of spidery handwriting: an eighteenth-century text on jurisprudence. Later, as we walked around the house, he pointed out a sixteenth-century Koran decorated with gold leaf and another, simpler Koran thought to have been crafted in the twelfth century. They lay in a display case, each book accompanied by a small business card describing its subject, author if known, and estimated age. “The manuscripts are our heritage,” he said. “It is the history of Africa, the history of mankind.”

The assertion explains the outcry that greeted news last week that Islamic militants might have destroyed Timbuktu’s manuscripts as they retreated from the city in the face of a French-led military advance. Timbuktu is thought to be home to perhaps 300,000 texts, divided among small heirloom collections, some two dozen private libraries like Haidara’s, and state-owned institutions. The oldest date back nearly a thousand years, the most recent a few hundred. Some are thick, bound volumes, others mere scraps; some are made of paper, others gazelle-skin parchment or tree bark. Their faded calligraphy was written in gum arabic mixed with charcoal and water, or colored inks, some of which were transported across the Sahara by camel and exchanged, along with salt and silk, for gold, ivory, and slaves. In subject matter they range from the sacred (early Korans, Islamic histories and treatises, biographies of the Prophet, prayer books), to the profane (astronomy, botany, genealogy, history, medicine, pharmacology), to the quotidian (inventories, receipt books, shopping lists).

Taken together, they show that Africa was not exclusively a place of oral history before colonialism, and that its history did not begin with the arrival of European explorers. Rather, while Europeans were stumbling through the Dark Ages, parts of Africa were enjoying a commercial, cultural, intellectual, and religious flowering that connected West Africa across the caravan highway of the Sahara to the Arab world and beyond.

In January I met Haidara again, this time 600 miles away in the capital Bamako, where he and tens of thousands of others had fled in the wake of the takeover of the north by jihadist groups last April. Tuareg separatists had signed a devil’s pact with Islamic militants, allowing their combined insurgency to deal Mali’s army a series of humiliating defeats that in turn precipitated a coup in Bamako last March. Once the north was under rebel control, the jihadist groups ousted their Tuareg allies.

After the Malian-led Ansar al-Dine (Defenders of the Faith) overran Timbuktu with the help of Al Qaeda in the Islamic Maghreb, the group imposed a strict Salafist interpretation of Islam, complete with Sharia law and routine brutality. In interviews, people who had fled towns under Islamist control told me of having their hands sawed off as punishment for theft. I heard of alleged adulterers stoned to death, of public floggings, and of bans that seemed designed to remove any joy from everyday life — on dancing, drinking, music, smoking, and soccer.

Denouncing much of Timbuktu’s heritage as idolatrous, the jihadists set about destroying the city’s ancient cemeteries and Sufi mausoleums with hoes, pickaxes, and machine guns. They desecrated the earthen fifteenth-century Sidi Yahia Mosque, breaking down a door that led to a tomb where some of the city’s 333 Sufi saints were buried. These acts of religious vandalism recalled the Taliban’s 2001 destruction of the Bamiyan Buddhas, and fears for the city’s manuscripts grew.

On the balcony outside Haidara’s third-floor apartment in Bamako, some of his five children played, drawing chalk sketches on two blackboards (and the walls to either side). Now forty-eight, he was more simply attired, in a plain turquoise robe, and his mustache had greyed. He sat in a living room with low banquettes around the perimeter, a thick Persian carpet on the floor. No books were in sight; on a large flatscreen in the corner, Ivory Coast was beating Tunisia in the Africa Cup of Nations soccer tournament.

“Things are very, very difficult,” he said, “but the manuscripts are safe and no damage has been done.”

Over the next couple of hours, as we sat shoeless on the floor drinking bittersweet tea from small glasses, Haidara explained how he and a handful of volunteers had set about hiding Timbuktu’s manuscripts. Every night for a month, he and fifteen colleagues met to pack texts into small metal boxes, the size of a treasure chest, that they bought at the local market. They started with Haidara’s collection, then moved on to others. When Timbuktu ran out of boxes, Haidara ordered more from Mopti, two days away by boat on the Niger River. All told, he said, well over 1,000 boxes of manuscripts were squirreled away — buried beneath mud floors, hidden in cupboards and secret rooms in private houses, or sent upstream on the Niger in wooden boats. “Most of the manuscripts are owned by families, and they gave me full responsibility for all of them,” he said flicking a hand up toward his hair. “It is a heavy burden; it has aged me. People said they would help, but I refused. I don’t want anyone else to know where they are all hidden.”

Over the centuries, Mali has fended off Moroccan armies, European explorers, and French colonialists; hiding manuscripts has become a near-standard response. Haidara told me that his grandfather had concealed the family’s collection from European treasure hunters, who stole some of Timbuktu’s manuscripts and took them to museums in London, Paris, and Rome. “The colonialists took the manuscripts,” he said, “so the intellectuals of Mali, of Timbuktu, hid them in secret rooms, in leather boxes buried in the ground. By the end of the nineteenth century, they had disappeared.” After independence and the establishment in 1973 of the Ahmed Baba Institute of Higher Learning and Islamic Research, named after a renowned sixteenth-century scholar, the books began to reappear. “I dug up our manuscripts, opened up the secret rooms, and brought the manuscripts out,” said Haidara. Timbuktu gradually began to regain its reputation for scholarship, attracting researchers from around the world.

As French and Malian soldiers evicted the jihadists from Timbuktu last week, reports emerged that the institute, home to some 30,000 manuscripts, had been torched and looted. But footage shot inside showed almost nothing: empty boxes, empty storage rooms and cellars. Haidara said it too had been cleared out last year as the new threat loomed, its manuscripts spirited away along with the others. He quite literally has the key to their whereabouts. Each metal box, he explained, has its own catalogue code and two keys — one of which he keeps, the manuscripts’ owners the other. All of his keys have been placed in a single locked box and hidden away, presumably in Bamako, though he wouldn’t say.

“All my life has been spent with the manuscripts,” he said. “It is all I know, so I did my best.”