The dramatic raid on Osama bin Laden's compound in a Pakistani suburb this week capped a decade-long manhunt, but it also revealed just how wrong the U.S. had been about where the world's most wanted terrorist was hiding.

Time and again, the nation's top national security officials told each other and the world that their best intelligence suggested that bin Laden was living along the mountainous, ungoverned border of Pakistan and Afghanistan.

"I have an excellent idea of where he is," CIA Director Porter Goss said in 2005.

"I believe he is in the tribal region of Pakistan," Director of National Intelligence Mike McConnell said in July 2007.

"This is a man on the run from a cave," White House homeland security adviser Frances Townsend said two months later.

"All I can tell you is that it's in the tribal areas. That's all we know, that he's located in that vicinity. The terrain is very difficult. He obviously has tremendous security around him," CIA Director Leon Panetta said in June 2010.

In reality, bin Laden was living comfortably in the bustling town of Abbottabad, known for its good schools and relative affluence. He was living in a walled compound in a military town, hundreds of miles from the mountainous, lawless tribal regions. There were no heavily armed security guards, as some intelligence officials assumed there would be. Thanks to a satellite dish, which officials believe was for television reception only, bin Laden would have been able watch American security forces chase him around the wrong part of the country.

"I was surprised that Osama bin Laden was found in what is essentially a suburb of Islamabad," former national security adviser and former Secretary of State Condoleezza Rice said Tuesday as news of the daring pre-dawn helicopter raid dominated the news.

America's belief that bin Laden was hiding on the Pakistani frontier was based on two assumptions, former intelligence officials said. The first was that bin Laden would stay close to his devotees for protection, and al-Qaida has thrived in the tribal areas of North and South Waziristan. The second was that if bin Laden had ventured into more civilized areas, his presence would be noticeable, first by locals and then by Pakistani and U.S. intelligence services.

But bin Laden realized that there are two primary ways the U.S. catches terrorists: from electronic surveillance and spies. And for years, he managed to distance himself from both.

He kept phone and Internet lines out of his house. Rather than employ legions of armed guards whose patrols could be noticed by satellites, he surrounded himself with high walls and only his most trusted aides. The U.S. could interrogate his foot soldiers and managers all it wanted. He'd still be safe.

Soon, the idea of bin Laden hiding in a cave become part of his mythology. And with so little intelligence coming in, the CIA's best analysts continued to say bin Laden was probably in the tribal regions. Occasionally there were indications to the contrary, but they were never anything solid.

In 2007, for instance, when bin Laden issued a video, some in the CIA's Counterterrorism Center believed his face did not show the strain of someone who had endured years of airstrikes, moving furtively across rough terrain, former senior intelligence officials said, speaking on condition of anonymity to discuss secret intelligence.

In hindsight, they were right. By then, bin Laden had likely been living in Abbottabad for roughly two years, with easy access to groceries and medicine.

But at the time, that hunch didn't prove anything. Bin Laden would be well fed, protected and cared for, even along the hostile border with Afghanistan, the analysts concluded. With no reliable informants and no electronic surveillance, there was simply not enough to change the prevailing wisdom. Some in the Counterterrorism Center believed bin Laden was hiding in Dir, a far-flung town on Pakistan's northern border.

"There were many of us who felt increasingly that the Waziristan leads were drying up rapidly," said Rob Dannenberg, the Counterterrorism Center's former chief of operations. "As our technical and human coverage increased in that part of the world, as challenging as it might have been, I think a lot us of felt that it wasn't feasible that he was going to be able hide in that type of environment."

Goss said he was always confident that bin Laden was in northern Pakistan but never had any indication he was in a densely populated area so far to the east.

"It was not the circumstance I thought was the likely one. It was further down the list," Goss said in a telephone interview Wednesday. "That fact, to me, needs more explanation."

U.S. officials have raised questions about whether their Pakistani counterparts knew, or should have known, that bin Laden was hiding in a town that's home to the country's military academy. Pakistan officials have flatly denied that and say they, too, were caught by surprise.

"It is shockingly embarrassing," former Pakistani President Pervez Musharraf told MSNBC on Wednesday.

While the CIA was wrong about the location of bin Laden's hideout, it was absolutely right about how the U.S. would someday get the terrorist mastermind. CIA officers believed for years that bin Laden's vulnerability was his reliance on couriers. In fact, sometime in 2006 or 2007, the agency all but stopped chasing reported bin Laden sightings, which had always been dead ends, and made the couriers the primary focus of their hunt, a former senior intelligence official said.

It was around that time that the CIA had learned the true identity of a trusted courier known by the nom de guerre Abu Ahmed al-Kuwaiti. Piecing together intelligence gathered from captured terrorists over the course of several years, the agency was confident that if it found al-Kuwaiti, it could be the best shot at finding bin Laden.

Finally, in the middle of last year, al-Kuwaiti was caught on a wiretap. He was far from bin Laden's compound, but it was enough to put the CIA on his tail. Last fall, he unwittingly led the agency to bin Laden's doorstep.

When President Barack Obama announced bin Laden's death, former officials said the years of fruitless searches were wiped away.

"People in the agency aren't used to seeing their work in a favorable light on Page One," former CIA Director Michael Hayden said Wednesday. "After this kind of work, this painstaking attention to detail, it's really heartening for them to see the reward for it on the battlefield, and the reward in the minds and heart of the countrymen."

Goss said he got a courtesy call on Sunday, cryptically telling him to watch the news that night. He said it was clear what was about to be announced.

"My feeling was it was certainly worth the wait," he said.


Follow Matt Apuzzo and Adam Goldman at http://twitter.com/mattapuzzo and http://twitter.com/reporterwdc