(Simon & Schuster)

In front of you, a mosque built of mud and clay that served as a center of learning in the Middle Ages. Here, scholars once gathered to discuss fine points of jurisprudence and philosophy. Poets set down their verses. Artisans created beautiful manuscripts, original works as well as copies of volumes from faraway times and places.

Now turn around and take in a different scene: a sandy square, where not long ago Islamist extremists meted out severe punishments for playing music and other crimes against sharia law. Children kick a soccer ball, the dust flies. All around you is an economically depressed, psychologically traumatized city wondering whether it has a future.

If you visit Timbuktu, as I did a year ago, you see these contrasts everywhere. And you feel the strangeness of the place. In an era of mass tourism, Timbuktu, in Mali’s northern desert, is still far away, intellectually (How much do Americans know of its history?) as well as logistically. (There are no commercial flights in or out because the security situation remains too tenuous.)

“The Bad-Ass Librarians of Timbuktu,” by Joshua Hammer, vividly captures the history and strangeness of this place in a fast-paced narrative that gets us behind today’s headlines of war and terror. This is part reportage and travelogue (there is a great deal of “setting off” in Land Cruisers, on camels and in small boats along the Niger River), part intellectual history, part geopolitical tract and part out-and-out thriller.

Hammer has reported from around the world for a number of publications, often from difficult-to-reach hot spots where trouble is brewing that most of us are too otherwise engaged to notice. Mali is a case in point: under-covered, seemingly off to the side of the news of the day, but home to a growing radical Islamist movement that wreaked havoc in the vast northern desert and came perilously close to seizing the entire country. It is an increasingly familiar story of the spread of radical Islam, failing or failed states, the fallout out from the Iraq War, and the uprisings in Egypt, Libya and Syria. In other words, the world we live in now.

Author Joshua Hammer (Courtesy of Joshua Hammer)

Mali, though, offered Hammer a most unusual way in, and he took it. Here the centerpiece is not bombs — though bombs explode and guns kill — but books: ­centuries-old manuscripts. Hammer’s pages are peopled by a marvelous, if bloody, cast of characters, including Moammar Gaddafi, al-Qaeda in the Islamic Maghreb leader Mokhtar Belmokhtar and the wonderfully named French Foreign Legion captain Raphaël Oudot de Dainville. But the main characters are not fighters or politicians, but scholars, book hunters, librarians.

Above all, there is the book’s hero, Abdel Kader Haidara, and the hundreds of thousands of manuscripts he helped collect and then save. The manuscripts, mostly from the 14th to 16th centuries, covered a wide variety of subjects: science, medicine, history, philosophy, literature and more. There were technical surveys of math and astronomy, serious ethical inquiries into slavery and good government, even early versions of self-help books, including on sexual matters. They came from a period when Timbuktu was a great trade crossroads, bringing different cultures into contact, and an important intellectual center, home to universities and mosques that attracted scholars from far and wide. Older texts, including translations of the Greek philosophers, were copied, along with new works.

For the Timbuktu native Haidara, born into a family that had its own private library, these manuscripts showed Islam as a tolerant, intellectually rigorous and open religion and culture, one he wanted the outside world to know. He wasn’t alone, but through sheer force of will he became the international face of a major preservation project. The stories of his colorful and sometimes perilous journeys to gather manuscripts make for some of the book’s most exciting passages.

For a time in the early years of this century, Timbuktu was on the rise, with money and tourists coming in, its Festival in the Desert attracting global rock stars (cue Bono). But then hard-line Islamist extremists swept in from the north and seized the city in 2012, and Haidara was forced to take on a different kind of preservation effort. As Hammer skillfully shows, this was both an old story — a continual battle within Islam — and a new one, now part of an international struggle in which superpowers send missiles into desert outposts.

At this point, “The Bad-Ass Librarians of Timbuktu” (an overwrought and unnecessary title) becomes a thriller, as Haidara organizes the collection of manuscripts and their passage far to the south and to the relative safety of the capital, Bamako. The rescue missions were carried out by volunteers who risked their lives, first in fleets of cars and taxis, later in small boats, right under the eyes of the new rulers. There were myriad adventures and dangers along the way, from jihadist roadblocks to bandits to corrupt Malian soldiers. But in the end, the vast majority of the manuscripts were saved.

It was the French who drove out the invaders. But not before a horrific period in which followers of one version of Islam brutally suppressed those of another. In a heartbreaking passage, a local resident tells Hammer: “We are a city that has had Islam for one thousand years. We had the greatest teachers and universities. And now these Bedouins, these illiterates, these ignoramuses, tell us how to wear our pants, and how to say our prayers, and how our wives should dress, as if they were the ones who invented the way.”

Who will win this battle? Hammer is too good a reporter to give us a heroic and happy ending. Even in recent days, as I read the book, reports came of al-Qaeda’s West African branch having regrouped and extended anew its reach in Mali and elsewhere. This story’s end has not been written.

Brown is a senior correspondent for the PBS NewsHour and author of the poetry collection “The News.”

The Bad-Ass Librarians of Timbuktu
And Their Race to Save the World’s Most Precious Manuscripts

By Joshua Hammer

Simon & Schuster. 288 pp. $26