When Afghan troops pushed into Kot, a district close to the border with Pakistan, this week, they found many of the houses empty, with posters plastered on the walls and black flags left by departing Islamic State fighters.
Backed by US special forces troops and airstrikes that authorities say have killed hundreds, the Afghan army has launched an offensive against insurgents, both Taliban and Islamic State, and prevented the fall of district and provincial centres.
Islamic State first appeared in Afghanistan at the beginning of 2015, and US officials say some 70 per cent of its fighters come from the Tehreek-i-Taliban Pakistan (TTP), the Pakistani Taliban, many from the Orakzai area in the frontier region on the Pakistan side of the border.
"They were former members of the TTP, complete with their leadership, who wholesale joined Islamic State ... earlier this year," US Army General John Nicholson said. "Seventy per cent, roughly, of those fighters are from the TTP, and many of them are Pakistani Pashtun from the Orakzai Agency."
Previously considered a much smaller threat than the Taliban, their bitter enemies, the Kabul bombing underlined how dangerous Tehreek-i-Taliban Pakistan could be, even without holding large tracts of territory.
"We have already destroyed their training camps in Kot district and the operations will expand to other districts too," said Shereen Agha, an Afghan army spokesman.
Other Islamic State members in Afghanistan were originally part of the Islamic Movement of Uzbekistan, another militant group, he said.
Afghan and US military officials believe the concentrated attacks on the movement over the past six months have killed many of its fighters and leaders and weakened the group, despite its ability to mount the Kabul attack.
"The fact that they could conduct a high-profile attack should not be perceived as a sign of growing strength," Nicholson said.
Involving both regular army and special forces, the operation in Nangarhar in the eastern part of Aghanistan dubbed "Wrath of the Storm", coincided with last week's suicide bombing in Kabul that killed at least 80 people and wounded more than 230 more.
Provincial government spokesman Attahullah Khogyani said 78 IS fighters had been killed in the operation, and many bodies had been concealed inside houses to hide the number of fatalities they had suffered.
Nicholson said this week that the number of IS fighters, estimated at around 3,000 in January, has been roughly cut in half and now stood at between 1,000-1,500.
However, after innumerable false dawns in decades of conflict in Afghanistan, officials in the NATO-led coalition that provides assistance to Afghan forces are cautious about declaring success against Islamic State, which President Ashraf Ghani promised to "bury" in January.