(CNN) -- A few months into the Iraq war, David Petraeus, then a three-star general and commander of the storied 101st Airborne Division, told CNN about what it would take to win.
"Frankly," he said, "the way ahead will require a lot of determination and just plain old ingenuity and stick-to-itiveness."
It was January 2004 and the United States had lost 60 men and women. No one could have predicted accurately the course of the war then, but Petraeus stuck to his playbook, eventually becoming the top U.S. commander in Iraq, leading U.S. counterinsurgency operations and, in 2007, a strategy to overcome a bloody insurgency that was fronted by a surge in troops.
Applauded for turning around what seemed a losing battle in Iraq -- he was dubbed King David for his successes -- Petraeus later went to Afghanistan, commanding U.S. and NATO forces there.
He is arguably the most influential general of his generation. In fact, Esquire magazine called him one of the most influential people of the 21st century.
But after a career that began after graduation in 1974 from West Point and as a second lieutenant in the infantry, Petraeus is hanging up the uniform for a civilian suit, leaving the Pentagon for halls of another hallowed Washintgon institution: the CIA.
Petraeus relinquishes his Afghanistan post on Monday. In an official ceremony, he will hand over command to Marine Lt. Gen. John R. Allen.
Petraeus plans to retire from the Army at the end of August and assume the CIA director's job September 6.
Some were stunned that a decorated military career was ending prematurely. Petraeus is only 58.
"I wanted this job," Petraeus said at his Senate confirmation hearing. "I am taking off the uniform I have worn for 37 years to do this the right way."
With that, the U.S. Army is losing the architect of modern-day counterinsurgency operations.
Petraeus wrote his doctoral dissertation on the lessons America learned in Vietnam. Later, he devised the Army/Marine field manual, challenging the military to think differently in how it relates to the civilian population in dealing with an insurgency.
This week, ahead of his departure, Petraeus assessed the results of his strategy in Afghanistan.
"What we have done is implement the so-called NATO comprehensive approach, a civil-military campaign ... that does indeed embody many of the principles of the counterinsurgency field manual that we developed back in 2006, and which we employed in Iraq in the surge of 2007-2008," he said in an interview with NATO-TV.
"I think generally, it has borne fruit."
He said it has been a difficult journey, rife with setbacks, but coalition forces have halted the momentum of the Taliban in much of the country and reversed the insurgent hold in restive Helmand province.
Petraeus's experience in working with the CIA on counterinsurgency efforts in the field was cited as a reason for his nomination as the spy agency's director.
Petraeus told NATO-TV that he never thought his military career would end in Afghanistan.
The top commander's job came unexpectedly after a Rolling Stone magazine article prompted the resignation of Gen. Stanley McChrystal. Obama asked Petraeus to leave the top post at U.S. Central Command. He took command in Afghanistan on July 4, 2010.
"We've jokingly said that I went to the White House for the monthly National Security Council meeting on Afghanistan and Pakistan with President Obama, and came out with a new job," Petraeus said. "And that's not far from the truth."