KABUL, Afghanistan — Afghanistan's president said Tuesday that Islamic State militants are "on the run" following a massive military operation that included elite commando units in remote districts on the border with Pakistan.

Ashraf Ghani attributed the success in dislodging ISIS loyalists to ground operations, close air support and the participation of retired commanders who had joined the commandos in taking on the extremists in the eastern Nangarhar province.

The local ISIS affiliate is mainly made up of former Taliban fighters disillusioned by the group's failure to overthrow the government despite a 15-year insurgency. Over the past six months ISIS had battled the Taliban in Nangarhar and gained a foothold in the region.

The region's proximity to the porous border, along with its steep valleys, provides protection for insurgents and allows them to smuggle fighters, weapons, poppies and other contraband.

Afghanistan's overwhelmed security forces initially held back, content to see the insurgents fighting among themselves. Once winter set in up north and fighting stopped, the Afghan forces began to concentrate their efforts on the warmer southern regions like Nangarhar, which did not see any seasonal slowdown in violence.

"I promised the people of Nangarhar that no quarter would be given to Daesh, and none has been given," Ghani said, using an alternative name for the Islamic State group. "In Nangarhar, Daesh is on the run."

Ghani spoke at a joint press conference with the Secretary General of NATO, Jens Stoltenberg, who is visiting Afghanistan for two days. Stoltenberg pledged further support to Afghan forces, emphasizing funding ahead of a NATO summit in the Polish capital Warsaw in July.

NATO and the United States officially concluded their combat mission at the end of 2014, but still maintain some 13,000 troops in Afghanistan, mostly engaged in training and support for Afghan forces. They also maintain an anti-terrorism mandate against the Taliban, al-Qaida and ISIS.

Political analyst Said Khalid Sadat, who lives near Nangarhar's provincial capital Jalalabad, disputed Ghani's upbeat assessment, saying the ISIS militants had merely been driven further north.

"We see and hear about their presence in Baghlan, Balkh, Kunduz even Nuristan provinces — this means they are expanding their foothold to the north and other parts of country," Sadat told The Associated Press.

In Kunduz province bordering Tajikistan, an official confirmed that IS militants had moved into Chahar Dara district, which was a base for Taliban fighters who last year stormed the provincial capital and held it for three days.

District governor Zulmi Farooqi said he had "confirmed the physical presence of Daesh in the district," but could not estimate their numbers.

"They came last year but failed to make any headway and left. Now they've started their activities here again," he said.

Hundreds of ISIS loyalists are also believed to have moved into central provinces after being forced out of Pakistan's tribal areas by a military operation last year.

Associated Press writer Humayoon Babur in Kabul, Afghanistan contributed to this story.