(Pablo Martinez Monsivais — Associated Press)

FORWARD OPERATING BASE SHARANA, Afghanistan — After 10 years of inconclusive war in Afghanistan, Defense Secretary Leon E. Panetta declared during a visit here Wednesday that “we’re winning” — but his burst of optimism proved short-lived.

U.S. military commanders and Obama administration officials have been exceptionally cautious about raising public expectations regarding the Afghan war, even with a surge of more than 33,000 U.S. troops to the war zone over the past two years. They have usually resorted to safe cliches in describing how the surge halted the Taliban’s momentum and “turned the tide” of the conflict.

More recently, they have spoken of “making progress” and moving “in the right direction,” but have shied away from mention of outright victory.

That changed briefly when Panetta visited this U.S. base in the southeastern province of Paktika, about 35 miles from the Pakistani border. Standing on dusty ground in the hilly terrain, he delivered a pep talk to a gathering of 200 troops from the 172nd Infantry Brigade.

“For all the sacrifices that you’ve made, the reality is that it’s paying off,” he said. “We’re winning this very tough conflict here in Afghanistan.”

Panetta only uttered the word “winning” once; subsequently, he described the war as being at “a turning point,” a phrase he has used often this week during other stops to see U.S. troops in Djibouti and diplomats at the U.S. Embassy in Kabul.

Asked about his use of “winning” by reporters later Wednesday, he declined to repeat it.

“As always, we have not won, we have not completed this mission, but I do believe we are in the process of making significant progress here,” Panetta said at a news conference in Kabul with Afghan President Hamid Karzai.

As evidence, he cited a weakened Taliban, reduced levels of violence and a strengthened Afghan national army and police force. “I think when you look at those achievements, clearly we are going in the right direction,” he said.

U.S. commanders have been carefully upbeat in recent weeks but have not gone as far as Panetta. “It’s clear that we have the initiative,” Army Lt. Gen. Curtis Scaparrotti, the second-ranking U.S. and NATO commander, said Wednesday. “We’re in charge on the battlefield.”

Scaparrotti came close to declaring victory against the Taliban in the movement’s birthplace and former stronghold in Kandahar and the Helmand River Valley, which is where the United States and NATO have concentrated their surge of troops since last year. But he quickly added an asterisk.

“In the south, I believe we’ve delivered a tactical defeat to the insurgency,” he said. “But we need to consolidate that gain.”

While the troops in Paktika province greeted Panetta enthusiastically — he also pinned Purple Heart ribbons on a dozen service members — they also expressed some skepticism about how the war will end.

“If the Afghan government falls apart after we leave here, are we going to have to come back in 10 years to pick up the pieces?” one soldier asked.

The Pentagon chief replied that the United States and its allies would continue to provide support to the Afghan government long after the end of 2014, the date President Obama has set for withdrawing U.S. forces from the country. “The answer to your question is: We are not going to walk away.”

Another soldier wanted to know how poor relations between the United States and next-door Pakistan were affecting the war mission and what could be done about it. Panetta allowed that was another tough problem.

“Bottom line is that it is complicated, it is complex, we have some difficult issues to deal with, but at the same time it is important to maintain the relationship with Pakistan,” he said.

But Panetta, still in a winning mood, said none of the problems confronting the war effort were intractable.

“Are there challenges out there? You’re damn right there are challenges,” the famously tough-talking secretary said. “Are we going to be able to take on those challenges? You’re damn right.”