WASHINGTON (AP) -- At the close of his time commanding U.S. forces in Iraq, at the height of a legendary military career, Gen. David Petraeus was lauded by his boss, then-Defense Secretary Robert Gates, as "one of our nation's great battle captains."
The depth of admiration for Petraeus' decades of accomplishment in uniform make it all the more remarkable that barely a year after retiring to head the CIA he resigned in disgrace over an extramarital affair.
Often talked about as a potential Republican presidential candidate in the mold of another popular war hero, Dwight D. Eisenhower, Petraeus built a reputation during 37 years in the Army as a skilled and personable leader with a penchant for publicity.
An ambitious soldier whose childhood nickname was "Peaches," he rose quickly through the ranks after graduating from the West Point military academy in 1974.
Shrewd, articulate, competitive -- Petraeus built an exceptional record of accomplishment in the Army.
He retired from the Army to become CIA director in the summer of 2011, shortly after completing 13 months as the top commander of U.S. and coalition forces in Afghanistan.
He famously remarked as U.S. forces conquered Baghdad in April 2003 only to face an unforeseen insurgency: "Tell me how this ends." As applied to the brief Washington chapter of his career, few could have foreseen this ending.
He sent a letter to President Barack Obama on Thursday asking that he be allowed to resign, and Obama on Friday said yes.
The "extremely poor judgment" that Petraeus said he exercised stands in sharp contrast to the resume of discipline, dedication, leadership and intellectual firepower that he built during an Army career in which he commanded soldiers at every level.
He earned a master's degree in public affairs in 1985 and a doctorate in international relations in 1987 -- both at Princeton University. When the campus newspaper, The Daily Princetonian, reported two months ago that Petraeus might be interested in becoming the university's president, he issued a statement in which he did not deny interest but said, "I am living the dream here at CIA."
Petraeus, 60, and his wife, Holly, have two children: a daughter, Anne, and a son, Stephen, who led an infantry platoon in Afghanistan as an Army lieutenant. He and Holly were married in July 1974 in the chapel on the West Point campus.
Petraeus' career was not without its bumps. He survived an M-16 round to the chest during a training exercise at Fort Campbell, Ky., in 1991. After his recovery, Petraeus rose through the ranks in a series of assignments that included executive assistant to the chairman of the Joint Chiefs, Gen. Hugh Shelton, plus stints in Haiti and Bosnia.
In 2000, he shattered his pelvis when his parachute collapsed during a free-fall jump. He was known in his middle age to challenge soldiers half his age to pushup contests -- and he would win.
During the invasion of Iraq in 2003, he led the 101st Airborne Division across the desert and won acclaim for stabilizing a sector of northern Iraq that later became a stronghold of al-Qaida's Iraq affiliate. Within one year, freshly promoted to three-star general, he positioned himself as an expert on the complexities of modern warfare and was put in charge of training the new Iraqi army. In July 2004, he graced the cover of Newsweek magazine, posing in front of a Black Hawk helicopter with the caption, "Can this man save Iraq?"
In early 2007 Petraeus was sent back to Iraq once again, this time to execute President George W. Bush's "surge" of forces at a time when many in Washington and beyond believed the war had been tragically lost.
Petraeus became the administration's leading ambassador for the Iraq war's progress. He had a close relationship with President George W. Bush and became known for his detailed PowerPoint presentations, burying lawmakers in charts that tracked everything from troop deaths and roadside bombs to power generation and school construction.
In 2007, after he reported progress in the war effort -- thumping legislative attempts by congressional Democrats to force troops home -- an anti-war group took out a full-page advertisement in the New York Times that coined a new nickname for Petraeus -- "General Betray Us" -- and blamed him for "cooking the books for the White House."
But by most accounts, Petraeus' strategy worked for the time being and he was hailed a hero who paved the way for the eventual U.S. exit from Iraq.
When Petraeus took his next assignment, as head of U.S. Central Command, in October 2008, Gates called him the do-it-all general, "the pre-eminent soldier-scholar-statesman of his generation."
Robert Burns can be reached on Twitter at http://twitter.com/robertburnsAP