BRUSSELS (AP) — Fifteen years after NATO took the lead on international security efforts in Afghanistan, the military alliance’s foreign ministers on Wednesday reaffirmed their commitment to stay the course despite mounting Afghan casualties and the slow pace of peace efforts.

At talks in Brussels, the ministers underlined their “steadfast commitment to ensuring long-term security and stability,” reaffirming that NATO’s mission in the insurgency-wracked country will last as long as conditions demand it.

NATO took the lead of the International Security Assistance Force in Afghanistan in 2003. It wound down combat operations in 2014 and began training and advising Afghan security forces so they could handle the country’s security needs. The work is carried out in a combat environment and remains dangerous.

U.S. forces, which entered Afghanistan in 2001 to oust the Taliban for harboring al-Qaida leader Osama bin Laden, now number around 15,000 and provide close support to Afghan forces and carry out counterterrorism operations.

The renewed NATO commitment came in a week when the Marine officer nominated to command U.S. forces in the Middle East warned that the fight there is at a stalemate and the number of Afghan troop deaths in the war is not sustainable. Four U.S. soldiers were also killed by a roadside bomb, the deadliest attack against U.S. forces this year.

NATO Secretary-General Jens Stoltenberg said the increase in violence could be a sign that things are about to change.

“Sometimes there is an uptick, an increase in violence because different parties try to gain the best possible position at the negotiating table. So it may actually become worse before it becomes better,” he told reporters.

NATO’s top civilian representative in the country, Cornelius Zimmermann, agreed that warlords and factions could be fighting for turf.

“We are hopefully at a pre-negotiation stage, and there are some elements trying to improve their bargaining position by trying to make military progress,” he said.

NATO and European leaders for years have expressed optimism about Afghanistan’s future while pouring billions of dollars into the security forces, development support and political and other assistance, yet the military alliance appears little closer to leaving the country than when it arrived.

Zimmermann based his optimism on Afghan President Ashraf Ghani’s unprecedented offer of unconditional peace talks with the Taliban, a recent and unprecedented three-day cease-fire agreed with the insurgents as a sign of goodwill and the changing attitudes of Afghan elders weary of years of conflict.

“This is clearly a qualitative step ahead” of what’s happened in the past, Zimmermann said.

Still, in Washington this week Lt. Gen. Kenneth McKenzie warned the Senate Armed Services Committee against an abrupt withdrawal of American forces or change in strategy.

“If we left precipitously right now, I do not believe they would be able to successfully defend their country,” McKenzie said. He said the U.S. and its allies need to keep helping the Afghans recruit and train forces to fight the Taliban’s estimated 60,000 troops.

On Oct. 30, Defense Secretary Jim Mattis said more than 1,000 Afghan personnel were killed or wounded during August and September alone. Ghani said in November that over 28,000 of his country’s forces had been killed in the last four years.

The U.S. and NATO military commander in Afghanistan, Gen. Scott Miller, insisted that the Afghans are doing more, running regional training centers and teaching their own special forces.

“That’s already more heavily balanced in terms of the Afghans doing their own training. What we try to do is help out where it’s required,” Miller told reporters in Brussels.

Afghan Foreign Minister Salahuddin Rabbani conceded that the security forces are sustaining many casualties, but he said they are increasingly successful in repelling enemy attack.

“In any war there are casualties on both sides and of course this is not an exception,” Rabbani said on the sidelines of the NATO meeting. “But as far as the determination and resolve of the Afghan security forces are concerned, I reassure you that they are very resilient.”