Gen. David Petraeus built an impeccable 38-year career in the military and U.S. intelligence, displaying a keen grasp of strategy and tactics that succeeded even on the murky battlefield of Iraq and carving out a sterling reputation that withstood the spiteful, partisan environment of Washington.