FT. MEADE, Md. — In nearly nine years as head of the nation's largest intelligence agency, Gen. Keith Alexander presided over a vast expansion of digital spying, acquiring information in a volume his predecessors would have found unimaginable.
In Iraq, for example, the National Security Agency went from intercepting only about half of enemy signals and taking hours to process them to being able to collect, sort and make available details of every Iraqi insurgent email, text message and phone-location signal in real time, said John "Chris" Inglis, who recently retired as the NSA's top civilian.
The overhaul, which Alexander ordered shortly after taking leadership of the agency in August 2005, enabled U.S. ground commanders to find out when an insurgent leader had turned on his cellphone, where he was and whom he was calling.
"Absolutely invaluable," retired Gen. David H. Petraeus, the former U.S. commander in Iraq, said in an interview as he described the NSA's efforts, which led to the dismantling of networks devoted to burying roadside bombs.
Alexander "sped the place up," Inglis said.
But something else seems likely to shape the legacy of the NSA's longest-serving director, who retired Friday: something that Alexander failed to anticipate, did not prepare for and even now has trouble understanding.
Thanks to Edward Snowden, a former NSA contractor, the world came to know many of the agency's most carefully guarded secrets. Ten months after the disclosures began, Alexander remains disturbed, and somewhat baffled, by the intensity of the public reaction.
"I think our nation has drifted into the wrong place," he said in an interview last week. "We need to recognize that those who are working to protect our nation are not the bad people."
When Snowden's disclosures began, Alexander and his deputies knew they were in for a storm. But they felt sure the American public would be comforted when they learned of the agency's internal controls and the layers of oversight by Congress, the White House and a federal court.
"For the first week or so, we all had this idea that we had nothing to be ashamed of, and that everyone who looked at this in context would quickly agree with us," Inglis said.
Instead, polls show, many Americans believe that the NSA is reading their emails and listening to their phone calls. A libertarian group put an advertisement in the Washington transit system calling Alexander, a 62-year-old career military officer, a liar. U.S. technology companies are crying betrayal.
The ease with which Snowden removed top-secret documents also embarrassed an agency that is supposed to be the first line of defense against cyberattacks.
In July, Alexander offered to resign, but the White House turned him down, he said. He didn't think holding other senior officials accountable would be right because a massive theft of documents by a systems administrator could not have been foreseen, he added.
The NSA has since implemented 42 changes to security procedures aimed at preventing a recurrence. In a system akin to that used with nuclear missiles, two people will be required for the sort of bulk movements of data Snowden handled, so each can watch the other.
Alexander blames the vehemence of the public reaction on what he views as sensational and misleading reporting, amplified by critics who want to radically curtail the agency. He sees a fundamental difference between the intelligence abuses uncovered by Congress in the 1970s — including revelations that the NSA spied without warrants on domestic dissidents — and the programs exposed by Snowden.
"What the Church and Pike committees found" nearly 40 years ago was "that people were doing things that were wrong. That's not happening here," Alexander said, referring to the panels headed by Sen. Frank Church (D-Idaho) and Rep. Otis Pike (D-N.Y.) that examined intelligence-agency activities in that era.
Outside reviews, including one released in December by a presidential task force, he said, found that "lo and behold, NSA is doing everything we asked them to do, and if they screw up, they self-report."
The task force reported it found "no evidence of illegality or other abuse of authority for the purpose of targeting domestic political activity." But it also noted "serious and persistent instances of noncompliance" with privacy and other rules. Even if unintentional, those violations "raise serious concerns" about the NSA's "capacity to manage its authorities in an effective and lawful manner," the report said.
Alexander's world view reflects a career in the national security bubble, said Michael German, a former FBI agent now at the Brennan Center for Justice, a civil liberties organization in New York.
"When you're the good guy and you're on the side of truth and democracy and the American way, anything that is an impediment to you is naturally bad and needs to be overcome, even if it's the law," German said.
But Timothy Edgar, a former White House privacy and civil liberties director who now teaches law at Georgetown University Law Center, said the NSA is "certainly not the villain in this story. They were doing exactly what the president and Congress told them to do."
What Alexander missed, Edgar and others said, was how Orwellian bulk data collection would look to a public with no context about how the NSA had been using the information.
Unlike the CIA, which makes a considerable effort to shape its image, the NSA had spent years shying away from public engagement. The agency's culture of secrecy is so extreme that in its early years, its existence was not even acknowledged. Unlike other intelligence agencies, the NSA didn't boast of its role, a crucial one, in helping find Osama bin Laden in Pakistan.
As a result, the NSA had little political capital when Snowden's disclosures began. Nor did its officials know how to deal with the barrage of stories. The resulting response was flat-footed, agency officials acknowledged privately.
"Keith's an engineer," said a former senior intelligence official who worked for Alexander and who commented on condition of anonymity. "With Keith, it was always, 'If we can do it, we ought to do it.'"
Alexander had a reputation for aggressiveness even before he came to the NSA. For much of his tenure, that approach helped him, particularly in dealing with one of the biggest challenges the NSA faced.
"They had so much data that they didn't know what to do with it, and one of Alexander's successes is how you make a mass of data your friend," said James Lewis, a cybersecurity expert at the Center for Strategic and International Studies in Washington.
Alexander implemented "big data" solutions that revolutionized the sorting and processing of intelligence. One such tool, created by young NSA engineers and later released to the public, was Apache Accumulo, a sorting tool that can process petabytes of data — many Libraries of Congress' worth.
The NSA relies on those sorts of innovations to keep ahead in the cat-and-mouse game of signals intelligence. And eventually, in five or 10 years, the United States will recover from the Snowden affair, Alexander said. But for now, once-fruitful tactics have become all but useless.
Sophisticated adversaries already knew a lot about U.S. capabilities, of course. But often, "the reason that we're successful is because people are lazy. They don't do what they're supposed to do," said retired Lt. Gen. Richard Zahner, a former senior NSA official.
Now, Russian ground commanders and Al Qaeda cell leaders are on notice that the NSA is nearly everywhere.
Alexander leaves office not knowing how deep the damage will go. It's a frustrating situation for a man who made his mark acquiring more information than anyone before him. Officials believe Snowden accessed as many as 1.7 million documents, but Alexander said investigators don't know how many of those he actually took, nor what he's passed to others.
"What the reporters have, what the Russians have, what the Chinese have" all remain questions, he said. "We don't know for sure on a lot of those things."
For the record, 2:40 p.m. April 2: A previous version of this article incorrectly quoted John Inglis, the NSA's former top civilian official, as saying that the agency had been able to acquire "every Iraqi email, text message and phone-location signal in real time." Inglis said that the agency had acquired metadata of insurgent communications. It was other former officials who said that obtaining the messages among insurgents required the agency to acquire virtually all Iraqi communications.