Bergen, a national security analyst for CNN, impressively covers it all: Al ­Qaeda’s aspirations and its 9/11 attack, the Bush administration’s panicky response, the subsequent invasions of Afghanistan and Iraq, the crucial and continuing unhelpful role of Pakistan, and the terrorist episodes in London and Madrid. Other books, most notably Bob Woodward’s series on the wars as viewed from Washington, have bitten off big chunks of this story, but Bergen’s, to my knowledge, is the first to credibly cover the global sweep of events over the last 10 years, exploring not just American views but also Al Qaeda’s. He begins by emphasizing the subtle long-term costs of early Western victories: how the 1967 war between Israel and its Arab neighbors undercut socialist Arab nationalism and instead spurred the rise of Islamic extremism; how the Persian Gulf war deployments of 1990-91 humiliated Arabs and intensified the ­anti-Americanism of Osama bin Laden and others. We did not notice it, but the war began back then. The first Qaeda attack against Americans came a year later, in Yemen. And the year after that, Bergen reports, Al Qaeda may have been involved in the “Black Hawk Down” battles in Mogadishu, Somalia. Bergen is a gifted if occasionally breezy writer, with an ability to find narrative perspectives and reach strong conclusions. (Like me, Bergen writes a blog for Foreign Policy magazine, but he and I have never worked together there nor had any other contact through the magazine.) He relates the events of 9/11 through the eyes of the intelligence specialists in the American government who had been studying Al Qaeda for years. As the aircraft struck the World Trade Center, Barbara Sude, who had completed a doctorate at Princeton in medieval Arabic thought and had more recently written a secret memorandum titled “Bin Laden Determined to Strike in U.S.,” remained at her desk at the C.I.A., intent on working on a response, even though she knew a third hijacked plane was heading toward Washington and possibly targeting the building in which she sat. Bergen is at his best in exploring the miscalculations and misunderstandings of both sides in 2001. Bin Laden naïvely believed that the West was as weak as the Soviet bloc, and thought it could be defeated relatively easily. He expected the response to the 9/11 attacks to be either a Western withdrawal from the Mideast or an ineffectual round of cruise missile strikes. But, Bergen also observes, the terrorist leader never showed much interest in the ways of Western culture. His beef with the West was not “our freedoms,” as President Bush would contend, but Western actions in the Middle East. Bergen is evenhanded but ferocious in reviewing the failures of the Bush administration, noting that in the wake of the worst security failure in American history, no one was fired, no one resigned and no one took responsibility. It’s widely understood that the White House ceded the moral high ground by embracing torture and secret prisons, but Bergen highlights how flatly unprofessional these actions were: seasoned interrogators were shunted aside in favor of eager amateurs who thought the facts could be physically wrung from detainees. Khalid Shaikh Mohammed, the mastermind of 9/11, was waterboarded 183 times, yet told his torturers nothing more about the 9/11 attacks than he had already voluntarily spilled two years earlier to an interviewer from Al Jazeera. Similarly, Ahmed Chalabi, the Iraqi exile, learned to bypass intelligence professionals and inject his fictions directly into the offices of his less knowledgeable allies in the Pentagon and White House. Colin Powell comes off as a chump who should have resigned in November 2001, when he learned about the administration’s new policy on detainees from a news broadcast on television, and long before he delivered one of the most misleading speeches in American history, his rallying cry for war at the United Nations. Dick Cheney appears less a brooding presence and more a red-faced buffoon, which may well be how history comes to regard him. I was surprised, however, at how badly Condoleezza Rice appears in this historical record. Bergen makes it clear that she was at best misleading about the actions of the administration. For example, she testified that the White House was on high alert before 9/11, but, he dryly notes, “the historical record does not reflect this.” As secretary of state, Rice reassured us that “the United States has not transported anyone, and will not transport anyone, to a country when we believe he will be tortured” — a statement that Bergen says we now know to have been “demonstrably false.” Yet Rice hardly stands out in an administration that confected the rationale for the invasion of Iraq out of a few stray rumors, stale leads and discredited reports. The only evidence Bush ever offered for a nexus between Iraqi weapons of mass destruction and Al Qaeda was based on information obtained though the interrogation of a Libyan militant that both the Defense Intelligence Agency and the C.I.A. had separately concluded was fabricated — well before the president used that information publicly. Bergen’s treatment of the Afghan and Iraq wars is necessarily brief, given the scope of his subject. But even here he makes insightful points. He explains why Tora Bora, late in 2001, was the most important battle in the entire war on terror. And in his overview of the Iraq war, he shows how Al Qaeda and its allies were able to take advantage of modern communications. “If Vietnam had been the first television war, and the 1991 war to liberate Kuwait from Saddam Hussein’s armies had been the first cable news war, Iraq was the first Web war,” he notes in an aside that a smart graduate student could expand into a good doctoral dissertation. The book sometimes slows, especially when Bergen does what reporters call a notebook dump and walks us through his on-scene interviews with various participants. He also lapses occasionally into jarring usages, like “this was no longer your father’s Taliban.” But such flaws are minor, and are far outweighed by this ambitious book’s many strengths. “The Longest War” is one of the most important accounts on the subject to appear in years. But be warned: You will read it and weep.