"You don't kill or capture your way out of an industrial-strength insurgency," he told The Associated Press in a telephone interview.
His comments come as a debate over the need to redeploy troops from Iraq to Afghanistan has become a central issue in the U.S. presidential campaign.
Petraeus, who is widely credited with pulling Iraq back from the brink of civil war, is taking over as chief of U.S. Central Command, the headquarters overseeing U.S. military involvement throughout the Middle East, as well as Afghanistan and the rest of Central Asia.
He'll hand over the reins in Iraq to Lt. Gen. Ray Odierno Tuesday during a ceremony at the U.S. military headquarters at Camp Victory on the western outskirts of Baghdad.
Petraeus' counterinsurgency strategy has paid off in Iraq, where the number of attacks has dropped to its lowest point in more than four years. But he will face a new challenge with violence rising in Afghanistan.
It will be a delicate balancing act to tackle a resurgent Taliban enjoying refuge in the lawless border areas of Pakistan without losing ground in Iraq.
"We've got a situation in Afghanistan where clearly there have been trends headed in the wrong direction," Petraeus said. "Military action is absolutely necessary but it is not sufficient."
"Political, economic and diplomatic activity is critical to capitalize on gains in the security arena," he said.
The 55-year-old general assumed control of U.S. forces in Iraq some 19 months ago after U.S. President George W. Bush ordered some 30,000 additional American forces to Iraq as part of a so-called surge aimed at stopping spiraling Sunni-Shiite sectarian violence.
The reason for the decline in violence is hotly debated, but the U.S. military cites the troop buildup, along with a Sunni revolt that saw former insurgents turn against al Qaeda in Iraq and a Shiite militia cease-fire ordered by strident American foe Muqtada al-Sadr.
Petraeus also acknowledged the military's dual role, calling U.S. troops "builders and diplomats as well as guardians and warriors" in his farewell letter posted on the military's Web site.
"The progress achieved has been hard-earned," he wrote. "There have been many tough days along the way, and we have suffered tragic losses. Indeed, nothing in Iraq has been anything but hard."
Petraeus stressed it was premature to discuss strategy but suggested he will carry over lessons from his playbook in Iraq - including possible outreach to try to bring hostile players into the political process.
Petraeus, however, stressed the ultimate decision to reach out to militants would be up to the Afghan government.
"We did reaffirm in Iraq the recognition that you don't kill or capture your way out of an industrial-strength insurgency," he said.
"Clearly there are so-called irreconcilables who must be killed or captured or run out of the country," he added. "But reconciliation with some of those who are currently part of the problem and making them part of the solution is something that I know is being examined as an option."
Bush announced last week that one Marine battalion and one Army brigade would be shifted from Iraq to Afghanistan this fall and winter - far fewer than the 10,000 troops U.S. commanders there had requested. Meanwhile, about 8,000 U.S. troops will be withdrawn from Iraq by February.
George Friedman, the head of Stratfor, an independent intelligence risk assessment agency based in Austin, Texas, said Petraeus faces a more organized enemy in Afghanistan with the Taliban and must consider reaching out to them along with tribal chiefs.
"He's struggling with the question of limited forces and a political climate that's much different than Iraq," he said. "But it's impossible to imagine how the United States can create an Iraqi-style solution without the Taliban because they're getting stronger every day."
Petraeus and other military leaders have consistently warned that the security gains in Iraq are reversible and need continued U.S. attention - a point underscored by persistent bombings that bear the hallmarks of Sunni insurgents.
And while security gains have been remarkable, the Iraqi government has largely failed to take advantage of the calm to make political progress.
Petraeus said the new challenges in Iraq include stalled provincial elections that are expected to redistribute power among Iraq's deeply divided groups, growing tensions between Arabs and Kurds over disputed territory in the north and the need to provide new employment for Sunnis fighters currently on the U.S. payroll.
He also warned al Qaeda and "residual militia elements" remain a threat.
"There are still very significant challenges and there will be for the foreseeable future," he said, warning against an overly rapid withdrawal of U.S. forces from Iraq.
"What we're wary of doing in a country that has had a surprise around every corner is unduly jeopardizing the gains for which our soldiers and our Iraqi partners have fought so hard," he said.