U.S. and Afghan special-operations troops pushed Islamic State fighters out of the district that the militants had aspired to make the capital of their local territory, the military said.

During a three-week offensive that just drew to a close, a pincer movement by Afghan commandos and U.S. Special Forces trapped hundreds of Islamic State militants in Gurgoray Valley, in Deh Bala District, 10 miles from the Pakistan border. The military estimates that combined air and ground attacks killed more than 160 fighters from Islamic State-Khorasan, as the local affiliate is known, with no casualties reported among Afghan or American forces.

“Life is getting back to normal,” said one Afghan soldier who participated in the battle. “Those who fled the fighting are slowly returning to their houses.”

As many as 1,750 people had been displaced by the fighting and sheltered temporarily in schools and tents, according to Nuha Al-Saeedi, emergency response coordinator for the Norwegian Refugee Council.

Local officials celebrated the operation’s success, but worried that militants would infiltrate back into the district now that Afghan commandos and U.S. Special Forces have left Deh Bala and returned to bases elsewhere in the country.