KABUL (Reuters) - Security problems and a spate of insider attacks on NATO troops in Afghanistan will not affect the alliance’s commitment to building Afghan forces capable of making the Taliban accept a negotiated end to the war, NATO’s top official said on Tuesday.

NATO Secretary General Jens Stoltenberg gestures as he speaks during a joint news conference with Afghanistan's President Ashraf Ghani (unseen) in Kabul, Afghanistan November 6, 2018.REUTERS/Mohammad Ismail

The aim is to build a force strong enough to show the Taliban that it is “pointless and counterproductive to continue the fighting”, Secretary General Jens Stoltenberg said during a visit to Kabul, where he met President Ashraf Ghani and senior NATO commanders.

“So there is a close link between our military efforts and our political efforts, a link between the strength of the Afghan security forces and the likelihood of progress in the peace process,” he told Reuters.

Efforts to achieve a peaceful settlement to more than 17 years of war have intensified, with meetings between U.S. special envoy Zalmay Khalilzad and Taliban officials aimed at preparing the way for peace talks.

“No one underestimates the scale of the challenge. And the situation remains serious,” Stoltenberg said during a joint press conference with Ghani in the presidential palace.

Even as peace moves have picked up, Taliban insurgents have increased pressure across Afghanistan, where they now hold more territory than at any time since the U.S.-led campaign of 2001 that ousted them from power.

At the same time, Afghan forces have been suffering their highest ever casualty levels, according to a report last week from the Special Inspector General for Afghanistan, a U.S. Congressional watchdog.

On Tuesday, hours before Stoltenberg met Ghani, Taliban fighters killed at least 20 Afghan soldiers at a security post in the western province of Farah.

NATO and its coalition partners have around 16,000 troops from 39 countries in Afghanistan, well down from over 100,000 at the height of the combat mission though higher than the 13,000 they had until the mission was beefed up last year.

Their main purpose is to train and advise Afghan army and police units as well as to provide a certain number of combat enabling services, including air support and intelligence.

Although the mission is no longer mainly a combat operation, the dangers of operating in Afghanistan have been underlined by a series of so-called “insider attacks” by rogue Afghan soldiers or police that have killed two NATO servicemen - an American and a Czech - in the past two weeks.

Stoltenberg said the threat of insider attacks and the high level of casualties suffered by Afghan forces was taken “extremely seriously” by NATO.

He had discussed the issue both with Ghani and the Resolute Support commander General Scott Miller, who himself narrowly escaped an insider attack in Kandahar last month, but it would not undermine the alliance’s commitment to the mission.

“It has led to some temporary adjustments of the way we provide support in some areas but that’s a temporary measure to address the immediate risks,” Stoltenberg said.