NATO’s reinforced mission will continue training Afghan forces, the alliance’s top official said Tuesday, even as government troops sustain higher numbers of casualties in a war now in its 18th year.

“This is a difficult situation,” NATO Secretary-General Jens Stoltenberg said during a visit in Kabul. “We see violence and instability, and we don’t underestimate the challenges.”

Stoltenberg, along with NATO Supreme Allied Commander Gen. Curtis M. Scaparrotti, met with coalition leaders and Afghan President Ashraf Ghani in Kabul at a time when security conditions in Afghanistan appear to be deteriorating.

After 17 years of war, there are few signs of progress as casualties among Afghan troops rise and attempts at peace talks with the Taliban insurgents have foundered.

While Ghani reiterated the importance of setting conditions for peace talks, the Taliban’s hand appears to be strengthening.

In recent months, the Afghan government has lost control or influence of more districts and the country’s security forces are suffering their highest casualties ever, the Special Inspector General for Afghanistan Reconstruction reported last week.

Stoltenberg said one reason Afghan casualty rates are higher is that NATO has pulled back from combat operations to focus on training and advising.

The Afghans are trying to do the job more than 100,000 NATO troops once did, Stoltenberg said. “Of course that has an impact for Afghan security forces.”

A decision in July by NATO to expand its mission from 13,000 to 16,000 troops is aimed at better preparing Afghan forces with a larger training mission, he said.

“We have decided to increase our presence and we have done that with more trainers, more advisers,” Stoltenberg said. “Our presence here is conditions based, it is not a timetable.”

The visit by top NATO leaders also comes amid an uptick in insider attacks against coalition troops.

While most U.S. and NATO troops are not formally involved in a direct combat mission in Afghanistan, U.S. troops still face risks from attacks by Taliban infiltrators or disgruntled local forces.

On Saturday, Maj. Brent Taylor was killed in insider attack at a training center in Kabul, marking the fourth such coalition death this year.

While Stoltenberg acknowledged the difficulty of the mission, NATO’s top official said he remains hopeful of an eventual peace for a country that has been involved in multiple wars for decades.

“The potential for peace is greater now than it has been in many years,” Stoltenberg said.