KABUL, Afghanistan -- Gen. Joseph Dunford took over Sunday as probably the last U.S. commander in Afghanistan with the job of ending America's longest war as insurgents continue to challenge the U.S.-backed Afghan government.
Gen. Dunford, a four-star Marine Corps officer, arrives as the U.S.-led NATO coalition has dismantled three-quarters of its 800 bases and watches to see whether the Afghan security forces it trained can keep the Taliban insurgency at bay.
A ceremony inside the coalition's compound in Kabul marked the end of the 19-month tenure of Marine Corps Gen. John Allen, whose command was marred by a rash of deadly insider attacks by Afghan forces against their U.S. and NATO trainers and strained relations with Afghan President Hamid Karzai.
In remarks tinged with emotion Sunday, Gen. Allen pointed to significant progress, including the growth of the Afghan security forces, an increase in Afghan-led military operations, a sharp reduction in civilian casualties and the withdrawal of about 35,000 U.S. troops.
"This is victory," Gen. Allen said. "This is what winning looks like, and we should not shrink from using those words."
Gen. Allen was cleared of wrongdoing last month in a Pentagon inquiry into emails he exchanged with a woman who was linked to the sex scandal that forced the resignation of CIA Director David Petraeus. He has been nominated to lead NATO forces in Europe.
By replacing Gen. Allen with Gen. Dunford, the respected but low-key assistant commandant of the Marine Corps, President Barack Obama hopes to repair relations with Mr. Karzai, to ensure a long-term security deal under which several thousand U.S. troops remain in Afghanistan beyond the withdrawal of combat forces next year.
Embracing Gen. Allen at the ceremony, Gen. Dunford stressed continuity in the mission.
"What's not changed is the will of this coalition," he said. "What's not changed is the growing capability of our Afghan partners."
Mr. Obama is expected to spell out plans for the troop withdrawal and a post-2014 U.S. military presence in Afghanistan as soon as his State of the Union message on Tuesday. While White House officials have said it's possible that no U.S. troops would remain in Afghanistan, Pentagon officials want to keep a residual force that would focus on counterterrorism and supporting Afghan forces.
Gen. Dunford will have a key seat at the table as U.S. officials try to negotiate the security agreement, which will hinge on assurances from Afghan leaders that they won't release prisoners currently in U.S. custody and will guarantee U.S. troops immunity from prosecution in Afghan courts. The failure to reach an immunity guarantee was a main reason why no U.S. troops remained in Iraq after the war ended there.
About 65,000 U.S. troops remain in Afghanistan, down from a high of 100,000. Despite flagging U.S. support for the war, military commanders argue that removing the remaining troops precipitously could cause Afghan security forces to collapse.
In his Senate confirmation hearing in November, Gen. Dunford offered no prescriptions for troop levels but cautioned against withdrawing too quickly, saying it could destabilize the region.
U.S. officials recently estimated that a residual American force could number from 6,000 to 9,000 troops -- fewer than the 15,000 senior military commanders had wanted. Experts say Gen. Dunford will be charged with figuring out how such a force could achieve U.S. strategic aims.
Even as the war winds down, challenges remain. The insider attacks that killed 61 NATO troops in 2012 have dissipated, but only after U.S. troops scaled back joint operations with Afghan forces, hampering training efforts. By next year, Afghan forces will be in the lead of all security operations but the Taliban, although weakened, retain the ability to attack in Kabul and other strategic areas.