– A U.S.-backed military offensive has stalled against ISIS’ last vestige in eastern Syria — in part because of the enemy that the allied fighting force had expected and other threats that it very much had not.

Booby traps, land mines and a militant counterstrike during a fierce sandstorm after the campaign began in September have knocked the coalition back on its heels.

And last week, the Syrian Democratic Forces, the Kurdish-led militia that is fighting ISIS with U.S. help, suspended operations after Kurdish positions farther north were shelled by Turkey — not far from U.S. advisers.

U.S. diplomats and generals rushed to ease tensions with the Turks, who consider Kurdish fighters terrorists despite their partnership with the United States.

But the episode underscores the shifting nature of the fight against ISIS, a still-potent threat as it pivots from its battlefield losses in Iraq and Syria to directing guerrilla insurgencies in the Middle East and beyond.

“Although ISIS’ safe haven in Iraq and Syria has largely collapsed, its global enterprise of almost two dozen branches and networks, each numbering in the hundreds to thousands of members, remains robust,” Russell Travers, the acting head of the National Counterterrorism Center, told senators in Washington last month.

Last week, ISIS claimed responsibility for an attack on a bus carrying Coptic Christians to a monastery in Egypt, which killed seven people and wounded 19 others. Dutch officials said in late September said they foiled a large, multisite ISIS attack there.

In Jordan, state intelligence officials said they had worked closely with the CIA to thwart more than a dozen terrorist plots in the past several months in the Middle East and Europe.

A classified U.S. military program in Jordan, called Operation Gallant Phoenix, is scooping up data collected in commando raids in Syria and Iraq and funneling it to law enforcement agencies in Europe and Southeast Asia, according to U.S. military and intelligence officials who described details of the initiative on condition of anonymity because of its secretive nature.

In Afghanistan, ISIS’ local branch has conducted a spate of high-profile attacks against civilian and government targets in Kabul while carving out a sanctuary in the country’s east, Travers said. Other ISIS affiliates in Egypt’s Sinai Peninsula, Libya, Yemen and western Africa continue to mobilize fighters and execute attacks against local governments and group rivals, fomenting and leveraging instability in these already beleaguered areas.

“ISIS remains an adaptive and dangerous adversary and is already tailoring its strategy to sustain operations amid mounting losses,” he said.

Other networks that are less formally aligned with ISIS, including extremists in other parts of Africa, Southeast Asia and the Philippines, continue to conduct attacks that showcase the group’s reach.

To be sure, thousands of ISIS members — including senior leaders, veteran field commanders and foreign fighters — have been killed in U.S. airstrikes and partner actions. The extremist group now holds less than 1 percent of the territory it seized in Iraq and Syria in 2014.

And the number of foreign fighters, once pouring into Iraq and Syria at about 1,500 a month, has dropped sharply. But ISIS still attracts about 100 new foreign fighters to the region each month, Gen. Joseph Dunford, the chairman of the Joint Chiefs of Staff, said in October.

ISIS has reverted to its insurgent roots — an atomized, clandestine network of cells with a decentralized chain of command, Western and Middle Eastern counterterrorism officials said.

The move follows plans that the extremist network drew up in the months before its main strongholds in Mosul, Iraq, and Raqqa, Syria, fell to coalition forces last year.

“We’ve expected that as the physical caliphate went away, the remnants of this would attempt to revive themselves and revive their networks, and take on these insurgent, guerrilla-like tactics,” Gen. Joseph Votel, the head of the military’s Central Command, said in an interview in Bahrain last week.

“We’re well prepared for that,” said Votel, who oversees the U.S. military in the Middle East and Southwest Asia. “These organizations never go away in one fell swoop.”