Iraqi forces and the Hashed al-Shaabi (Popular Mobilization units) advance Nov. 25 through Anbar province, east of the city of Rawah in Iraq’s western desert bordering Syria, in a bid to flush out remaining Islamic State fighters. (Ahmad Al-Rubaye/AFP/Getty Images)

Every day for more than three years, the U.S.-led coalition bombed Islamic State targets in Iraq and Syria, for a total of nearly 30,000 strikes. But on Nov. 26, not a single airstrike was launched.

Just a week earlier, Iraq’s military had won back the last sliver of territory controlled by the militants. The Pentagon has announced that 400 Marines deployed to Syria to fight the group will be returning home.

Those milestones appear to mark the Islamic State’s defeat, with the end of its self-declared caliphate. But the battle isn’t over.

Iraqi and Syrian forces have yet to secure their porous border, which the Islamic State’s ministate once spanned, and are still chasing militants in canyon-filled deserts. Nor has the U.S. military determined its role now that major combat is over, although American and Iraqi officials have suggested that a major drawdown of U.S. troops is possible.

Most urgently, Iraq and Syria are girding for a wave of terrorist violence, such as the attack that killed more than 300 people at a mosque in northern Sinai in Egypt in late November.

Iraqi forces are transitioning into policing roles that will call for them to gather intelligence and break up sleeper cells. U.S. forces are assisting by working with police forces and army units tasked with preventing the militants from staging attacks in places they once held, said Col. Ryan Dillon, the spokesman for the U.S.-led coalition fighting the Islamic State.

“We fully expect them to go back to their insurgent roots,” he said.

But the unpredictable politics of Iraq and Syria, and rivalries over territory, could derail counterterrorism efforts.

In Iraq, an elite U.S.-trained counterterrorism force has been drawn into a political and military standoff between the Iraqi government and a Kurdish effort to secede.

The force’s units were expected to return to their provincial headquarters throughout Iraq as the battle against the Islamic State wound down. Instead, they have been scattered across northern Iraq to areas disputed by Baghdad and the Kurdistan Regional Government, said Lt. Gen. Sami al-Aridhi, the commander of one of the three divisions of the force.

“This is our new thing,” he said, describing their presence near Kurdish regions.

Resolving the crisis would allow the counterterrorism units to return to their designated role as a bulwark against Islamic State attacks, such as one in September that killed more than 80 Shiite pilgrims in southern Iraq. Such assaults underscore the sustained threat posed by the Islamic State despite its territorial losses.

Securing Iraq’s border with ­Syria and the desert region on both sides is a crucial step toward preventing more bloodshed, military commanders said.

Iraq’s army and allied Shiite militias have cleared about 5,400 square miles of desert in western Iraq, but about that much still must be secured, Iraqi commanders said.

The area includes smuggling routes and militant hideouts that Iraqi forces are reaching for the first time in 14 years, said Maj. Gen. Qassim al-Mohammadi, the commander of western Anbar province operations.

“It was used as a place for the terrorist groups to mobilize and train,” he said. “The biggest challenge facing us now is the large size of the sector. It’s hard to inspect it fully.”

Iraq’s military has been using air power to destroy militant positions in the vast region, which is devoid of civilians. American strikes have not been needed, Dillon said, raising fresh questions about the long-term U.S. role.

The presence of American forces in Iraq has long rankled Iran-backed Shiite militias, and their leaders have demanded a withdrawal now that the Islamic State’s caliphate has been toppled.

Iraqi Prime Minister Haider al-Abadi has said he expects the American troops to begin drawing down from the peak of 5,200 earlier this year but wants some to stay to continue training Iraqi forces in intelligence gathering and information sharing.

"It's not in our interest, nor in the interest of other countries in the region, for terrorists to regroup again," he said in an interview this fall.

Abadi said Iraq would not celebrate victory over the Islamic State until the militants are routed in the western desert and the border with Syria is sealed.

The outlook in Syria is far murkier. The Trump administration has indicated that American forces could have an open-ended mission there until a political solution to Syria's war is worked out. That halting process involves Syrian President Bashar al-Assad and his Russian and Iranian allies, and U.S.-backed opposition groups.

Experts and rebel commanders warn that the Islamic State remains a potent threat in Syria and that the country’s fractured political climate could help the militants regroup.

“Governments like to talk about ISIS in terms of metrics, numbers, cities taken. What we forget is that ISIS is more than a presence on the ground. It is a political force, an ideological force, and it says something about the world that people across Syria and Iraq have been living in,” said Tobias Schneider, an international security analyst, using another name for the Islamic State. “We are not one step closer to solving those politics.”

As Assad’s government recaptures territory, the most unpopular components of its rule are in place. Tens of thousands of people remain in squalid government jails, and economic inequalities have been sharpened by a war economy that rewards government loyalists as much of the population relies on aid handouts.

“Terrorist groups will not disappear while the conditions that allowed them to flourish are still here,” said Mustafa Sejari, an official with the Pentagon-backed al-Mutasim Brigade, a rebel group fighting the Islamic State. Now stationed in a Turkish-protected enclave in northern Syria, his group has faced a string of counterattacks over the past year.

The involvement of Iran- and U.S.-backed proxy groups in the war again the Islamic State in ­Syria could soon pose problems, ­analysts said.

“I think we underestimate the degree to which all of these territories which we say are under the control of central forces are still under control of local forces, and it’s not hard for those to switch sides,” Schneider said.

That outside forces brought down the Islamic State should give the United States and its partner force pause as they focus on restoring stability to the areas they have seized, said Nicholas Heras of the Washington-based Center for a New American Security.

“That should be worrying for the U.S. and its partners in Syria because it speaks to the degree to which ISIS can seed its operatives, all local Syrians, into the security and governance structures that are currently being built to replace it,” he said.

Of particular concern are the parts of eastern Syria where the fighters have set up base.

Heras said that region, which abuts Iraq, “will be a sea of turmoil as ISIS ramps up its insurgency mission over the coming months and years.”

Loveluck reported from Beirut. Zakaria Zakaria in Istanbul contributed to this report.

Read more: