Updated

Islamic State and the Taliban, after more than a year of fierce combat, have forged a patchwork cease-fire across much of eastern Afghanistan that has helped both insurgencies regroup and counter U.S.-backed efforts to dislodge them.

Until several months ago, Islamic State fought bloody battles with local Taliban units over fighters and territory in several provinces. The long-running Taliban insurgency has sought to stamp out its smaller rival, which only emerged in 2014. Afghan and U.S.-led coalition forces took advantage of the conflict, engaging the militants on multiple fronts to push them back and reclaim territory they held.

But recently, Afghan officials say, the two insurgencies have worked out local deals to stop fighting each other and turn their sights on the government. The upshot is that Islamic State has been able to focus on fighting U.S.- backed Afghan forces in Nangarhar province and shift north into Kunar province, establishing a new foothold in a longtime Taliban and former al Qaeda stronghold.

“They fought deadly battles with the Taliban before. But over the past two months, there has been no fighting among them,” said Gen. Mohammad Zaman Waziri, who commands Afghan troops in the east.

Islamic State’s presence in Afghanistan is still nascent. Even in its stronghold Nangarhar, Afghan officials estimate the group remains several times smaller than the Taliban. And the cease-fire between them could break apart at any time.

But Islamic State has exploited the relative peace with its rival to extend the reach of its deadly attacks. In July, Islamic State claimed responsibility for a suicide bombing in Kabul that killed more than 80 people, one of the worst attacks in the capital since 2001.

Islamic State’s alliance with the Taliban comes as the U.S. steps up efforts to combat it. A joint Afghan-U. S. operation against Islamic State in February was hailed as a success until it became clear the militants had regrouped and were regaining lost ground.

In recent weeks, the U.S. military has pulled more troops into Afghanistan for a new joint offensive with Afghan forces involving heavy airstrikes and operations targeting commanders. The U.S.-Afghan operation in the east has cleared Islamic State strongholds in several districts in Nangarhar province, driving the militants further into mountainous areas close to the border and north to Kunar and Nuristan provinces.

The top U.S. military commander in the country, Army Gen. John Nicholson, said the cease-fire between the militant groups in Kunar didn’t reflect a broader agreement. “There’s still a conflict even though they may have a local cease-fire in place,” he said. “There’s always been a live-and-let-live dimension to some of the social fabric.”

Click for more from The Wall Street Journal.