I learned of a place called Afghanistan as many Americans used to do: by reading one of the most famous opening chapters in literary history. I was 11 years old, and my new book introduced a young English doctor. Sent to an outpost of the Empire, he was hurried ahead to the front lines of a persistent war. He united with his assigned unit in Kandahar, and nearly died in combat when his shoulder was shattered by a bullet. Recuperating back in London, seeking an affordable apartment, he met a potential roommate — a strange fellow among whose first words to him were:

“You have been in Afghanistan, I perceive.”

Thus Dr. Watson met Sherlock Holmes.

Given their mutual interest in Afghanistan, the famous detectives may have absorbed a few years later the work of an eager young journalist named Winston Churchill, who traveled with British troops some 125 years ago as far as the northwestern limit of British India — land that would become Pakistan. There, at a line Britain had drawn between its dominion and the mountainous lands beyond, Churchill observed tribal fighting that had gone on for all recorded time. Through countless feuds and truces, bargains and betrayals.

Churchill recognized that the Pashtun tribes would never honor a Western line through their ancient territories. Observing the fighters known as Talibs — passionate and violent young men afire with religious fervor — he concluded that their holy wars were endless.

Talib. Taliban. Endless.

Everything the United States should have known was knowable before we plunged without planning into the graveyard of empires. It is a gift to be able to learn from the mistakes of others. The original authors of the American engagement in Afghanistan — with names like Bush, Cheney and Rumsfeld — were not gifted in this way. They chose not to learn, or to ignore what they learned, or to think that they were somehow different.

A striking scene from the endless war finds Gen. Stanley McChrystal, long since retired, trotting along in Kabul on his daily eight-mile jogs. Multitasking, he listens to Churchill’s 1898 book as he goes. One of many splendid officers dispatched to find a way through the Afghanistan morass, McChrystal showed admirable diligence, but by this time, the United States was some eight years into the war. Shouldn’t the British experience have been fully digested by then?

Or if Churchill’s book was too dusty, too Kiplingesque, someone could have read Barnett Rubin’s 1995 books, “The Fragmentation of Afghanistan” and “The Search for Peace in Afghanistan.” Dense with detail from the Soviet debacle of the 1970s and 1980s, the books — spoiler alert — contain a lot more fragmentation than peace.

Certain themes are consistent across the distance of a century. There’s the near-impossibility of creating a strong central government in a land of tribes and clans. There are the constantly shifting allegiances and temporary alliances. There’s the fierce skepticism and outright hostility of the uneducated majority toward the educated elite. There’s the infinitely porous frontier that makes Afghanistan a part of Pakistan and Pakistan a part of Afghanistan in a tangle of intrigues too ancient and too complex to be unraveled. There is the tendency of outside powers to play Afghan pawns in their global chess games.

One cannot say whether greater awareness of this history would have revealed a path to success for the authors of the American story in Afghanistan. Certainly, it would have made them more cautious, more circumspect. It might even have made them sympathize with the U.S. leaders who would eventually have to write an ending to the tale. More wisdom in the beginning could have meant less catastrophe at the end.

Craig Whitlock of The Post has now added another sadly illuminating volume to the shelf of Afghanistan cautionary tales. “The Afghanistan Papers” draws on thousands of government documents to reveal the hubris, ignorance and deceit that kept Americans enmeshed for nearly 20 years in our longest war. The warriors and diplomats assigned to the effort are shown in their own words arriving at the knowledge that the project is doomed. But they can’t find a way to get ahead of the unfolding disaster, much less tell the full truth to the public.

Whitlock introduces readers to a sort of modern-day Dr. Watson, Staff Sgt. John Bickford. Like his fictional counterpart, Bickford finds himself recuperating from war wounds suffered in fighting not far from Kandahar. Instead of meeting a detective, he meets an official interviewer from the U.S. Army. It was 2006, and most Americans thought the Taliban was defeated. Not so, Bickford tells his visitor. The Taliban had simply crossed into Pakistan to regroup.

“Now they’re back stronger than they have ever been,” he testifies.

“They’re the enemy but they deserve tons of respect,” Bickford continues, “and they should never, never, never be underestimated.”