WASHINGTON -- In a reflective farewell on Wednesday evening, Gen. John R. Allen recalled a recent trip to Section 60 of Arlington National Cemetery where, he said, "you can see the entire swath of the American experience in Afghanistan."
The American war dead from Iraq and Afghanistan are buried in that area of the cemetery. Their numbers include the 541 troops killed in Afghanistan during the 19 months that General Allen served as the senior commander there.
Among the rows of headstones, General Allen said, he saw a young widow with her children at a funeral. At a grave nearby, another family had set up lawn chairs to which birthday balloons were taped. At yet another grave, a young soldier was crying inconsolably.
"That is the price we have paid to deliver this campaign to the point it is today," said General Allen, who then asserted that the sacrifices had been worth it.
The comments came a day after President Obama announced that General Allen, a four-star Marine Corps officer, would retire from the military to focus on "health issues within his family." Mr. Obama had nominated General Allen months ago to be the supreme commander of NATO, but the general recently decided to leave the military.
General Allen had been caught up in the scandal that led to the resignation of David H. Petraeus as the director of the C.I.A., although last month the Pentagon officially cleared him of misconduct after an investigation into his exchange of e-mails with Jill Kelley, a Tampa, Fla., woman who was also a friend of Mr. Petraeus's.
The general's observations on Wednesday came at a dinner given in his honor by the Institute for the Study of War, a nongovernmental research organization.
With his wife, Kathy, in attendance, General Allen said that the day before he had reviewed his tour with Mr. Obama. He offered a generally upbeat view of the war.
"I told him that in my mind the Afghan campaign is on track," he said.
General Allen insisted that Afghan troops had made progress in taking the lead in the fighting. American and allied forces, he said, were making the transition from a combat role to a support role and had closed more than 500 bases.
He said that the insurgents' use of sanctuaries inside Pakistan to prepare for attacks in Afghanistan remained the "principal operational threat" but added that there were opportunities for Afghanistan and Pakistan to cooperate.
He acknowledged that numerous hurdles remain, including the pervasive unease many Afghans feel about neighboring states, their economy, the durability of the international commitment and their own government's ability to make good on its many promises to fight corruption.
"Uncertainty is perhaps one of the great challenges that the Afghans face about the future," he said.
General Allen steered clear of one of the most important uncertainties of all -- how many forces the United States and its allies are willing to keep in Afghanistan and for how long. Mr. Obama has not yet decided how many troops to keep in the country after 2014, when the Afghans are to assume full responsibility for their own security. That decision will have a major bearing on the degree to which the United States and its allies can advise and support Afghan forces, and how effective the Afghan forces can be in the field.
The general suggested that one way the United States and its allies could assess what has been accomplished is the election in Afghanistan set for 2014.
"In so many ways, the outcome of that election will be how the international community will have judged all that we have done," General Allen said. "It will be the means by which the Afghan people judge whether democracy can really take root in this country."
This article originally appeared in The New York Times.