No general in the U.S. military had a more loyal retinue of staff officers than retired general David H. Petraeus.

Many of these soldiers had followed him through multiple tours in Iraq and Afghanistan over the past decade. The collapse of his storied career after his admission of an affair has left them all asking the same questions: How could the illicit relationship have happened? And how does it square with the officer they knew and admired?

In some cases, the first question is asked literally. In Afghanistan, it would have been nearly impossible to conduct an affair out of their view. Petraeus had a small office in the cramped NATO headquarters and slept in a tiny trailer set amid the living quarters of his staff officers. Indeed, the former general has told those close to him that, although he was close with his biographer, Paula Broadwell, in Afghanistan, he did not begin the affair with her until after he left the military last year.

But for many of Petraeus’s former staff officers, the bigger question is how a general who preached the importance of self-discipline and integrity, who almost never seemed to lose control of his emotions during a decade of almost nonstop stress and combat, stumbled so badly in his personal and professional life.

“I am really shocked by it because it is so different from the Petraeus I knew over the course of three tours of Iraq,” said one Army officer who was part of Petraeus’s inner circle and who asked for anonymity so he could speak candidly. “We’ve all been e-mailing back and forth. This is the last thing in the world we would imagine. He did a lot of good for the country and a lot of good for us.”

Since his first combat tour in Iraq in 2003, Petraeus had cultivated a cadre of a few dozen loyal staff officers, many of whom had doctoral degrees from top universities and taught at the U.S. Military Academy at West Point. Usually, he personally selected these men and women to serve on his staff.

In Afghanistan, the retinue grew as people drawn to his fame and eager to launch their own careers took up positions for him in Kabul. “He didn’t seek out these people, but he also didn’t turn them away,” said an officer who spent 40 months working for Petraeus in Iraq and Afghanistan.

Prominent members of conservative, Washington-based defense think tanks were given permanent office space at his headquarters and access to military aircraft to tour the battlefield. They provided advice to field commanders that sometimes conflicted with orders the commanders were getting from their immediate bosses.

Some of Petraeus’s staff officers said he and the American mission in Afghanistan benefited from the broader array of viewpoints, but others complained that the outsiders were a distraction, the price of his growing fame.

Broadwell, who first met Petraeus when she was a doctoral student at Harvard, was treated as though she were a member of Petraeus’s inner circle and was afforded VIP housing at the main U.S.-NATO headquarters in Kabul.

“In Iraq, General Petraeus was adamant that he didn’t want reporters embedded within his headquarters in any way,” said retired Col. Peter Mansoor, who served as Petraeus’s executive officer. “What troubles me is why he decided to change his own guidance and allow her unfettered and lengthy access.”

One of the inevitable questions following Petraeus’s fall was whether his fame, his ego and the sometimes fawning treatment from the media and politicians led to his affair with Broadwell, who was 20 years his junior.

“Over the years I knew him, he became increasingly fixated on his image,” said one U.S. official who worked with Petraeus in Iraq and Afghanistan.

But those closest to the general said the acclaim did not change the way he commanded troops or interacted with his staff. Petraeus seemed especially well suited for the fame that he achieved in the Iraq war. He had served as a top aide to three prominent generals in the Pentagon and Europe and had a practiced ease with the reporters whom he had known, in some cases, for more than a decade.

“I find it hard to believe he had difficult dealing with the fame,” Mansoor said. “I think he truly expected it. No one in the Army was better positioned to deal with the notoriety.”

Another theory advanced by Petraeus’s most loyal staff officers is that his retirement from the Army to become director of the CIA might have led to his collapse.

His military career had defined his life since his days as a West Point cadet and his marriage to his wife, Holly, the daughter of a general. In public, he seemed to miss the comfort and confidence that his uniform provided.

He recently showed up to speak at a dinner in Washington wearing a row of military medals on the lapel of his suit jacket. The brass prompted a few double takes from a crowd in which only uniformed military men had donned their medals.

Former defense secretary Robert M. Gates, a CIA veteran, had advised Petraeus not to bring his entourage of former military officers to the agency. The former general showed up for his first day at the agency alone.

At the CIA, Petraeus still retained a big staff and the perks of high office, including a staffer to accompany him on his morning runs when traveling and a standing order to ensure he had fresh, sliced pineapple on the road before he turned in for bed.

But he lost the daily and immediate connection to the military family that had sustained him over the course of the past decade of war.

As his old staff officers moved onto new Army assignments, Broadwell stayed close, going on long runs with him and helping to pick out a wardrobe of tailored suits he would wear at the CIA.

“In the Army, he had a built-in group of associates to run with him, joke with him and keep him company,” said one Petraeus confidante. “He lost that when he left the Army. Maybe he should have rented some staff officers to bring to the CIA.”

Rajiv Chandrasekaran and Greg Miller contributed to this report.