QAIM, Iraq — Islamic State militants who escaped the defeat of their self-declared caliphate in Syria earlier this year have been slipping across the border into Iraq, bolstering a low-level insurgency the group is now waging across the central and northern part of the country, according to security officials.

About 1,000 fighters have crossed into Iraq over the past eight months, most of them in the aftermath of the caliphate’s collapse in March, said Hisham al-Hashimi, a security analyst who advises Iraq’s government and foreign aid agencies.

These fighters, mostly Iraqis who followed the Islamic State into Syria, are returning home to join militant cells that have been digging into rugged rural areas, sustained by intimate knowledge of the terrain, including concealed tunnels and other hiding places.

The militants move under the cover of darkness to carry out sniper attacks and rudimentary roadside bombings several times a week.

Their attacks, occurring outside major cities, are often opportunistic and primarily target community leaders and security forces involved in efforts to root them out. An explosion earlier this month in the northern city of Kirkuk killed two motorcyclists. A separate attack in Diyala, in eastern Iraq, targeted militiamen assigned with hunting down militants.

Islamic State media has published grainy videos showing the assassination of paramilitary fighters and local notables, such as “mokhtars,” tasked with helping security forces identify individuals linked to the extremist group. 

“I warn all the mokhtars that the Islamic State can reach anywhere they want,” said one abductee in a video released earlier this year, addressing community figures like him who had cooperated with government forces.

Even truffle hunters have been kidnapped, apparently after roaming too close to the militants’ desert hideouts.

Iraqi security forces announced this month the start of a new military campaign to secure and clear the desert along the country’s 370-mile border with Syria. Within days, they reported the discovery of bombmaking factories and said several militants had been killed.

On the ground, the challenge of uprooting Islamic State fighters appears daunting.

“Look at where they’re hiding. It’s deserts. It’s caves. It’s places no one can ever fully control,” said Col. Saad Mohammed as he drove through the rocky desert of western Anbar province, gesturing toward a vast open expanse. “How many units would we need to secure every inch? Too many. No one has that capacity.” 

A veteran of the campaign that defeated the Islamic State caliphate, Mohammed said he fought in every major battle Iraqi army forces waged in ousting the group, taking seven bullets to the chest in a firefight near the dusty border town of Qaim in 2017. 

The Iraqi government announced its victory over the Islamic State’s caliphate in late 2017, a month after security forces ran the militants out of Qaim, located on the east bank of the Euphrates River. 

This spring, Iraqi soldiers looked across the river into Syria as the group made its final stand. U.S.-backed forces surrounded tens of thousands of the Islamic State’s most die-hard adherents in the Syrian village of Baghouz, many of them hiding underground, during a weeks-long battle for the last remaining half-square-mile claimed by the caliphate. The Euphrates trembled under airstrikes, soldiers said, and carried away the corpses of men who drowned as they attempted to escape. 

The scene along the river is quiet now, but fugitive Islamist militants are continuing to slip across the frontier into Iraq, often disguised as shepherds, at times undetected and with their destinations unknown, according to security officials. Some militants travel on foot. More commonly, they snake through the desert in cars, sometimes detected by surveillance drones and targeted by Iraqi or U.S.-led coalition airstrikes. 

When the Islamic State fighters are cornered, they hit back fiercely. “Then, they’re fighting for their lives,” an Iraqi military commander said.

Describing a recent raid on an Islamic State hideout near the western town of Rutbah, another senior military official said the helicopter transporting his soldiers was targeted with rocket-propelled grenades even before it reached the ground. “These are tough fights. They’re not giving up,” he said. Both officers spoke on the condition of anonymity because they were not authorized to talk to the news media.

The Islamic State cells are confined largely to rural hinterlands, according to Iraq’s Defense Ministry and analysts tracking the group. There are few indications that the group can once again control large amounts of territory or win significant support. But experts warn that the low-level insurgency can terrorize communities into turning a blind eye to the militants’ activity as they dig in, preparing for a longer-term struggle. 

“It doesn’t necessarily need to win people over in order to cow them into collaboration of noncooperation,” said Sam Heller, an expert with the International Crisis Group. 

During its sweep to power, the Islamic State cast itself as the protector of Sunni Muslim communities facing persecution by the Iraqi state, dominated by Shiite Muslims. Since then, the rise and fall of the group has torn Iraq’s national fabric, dividing communities and contributing to the destruction of entire districts as the U.S.-led coalition fought grinding battles to dislodge the militants. 

The brutality of the extremists and the trauma of war, combined with the stigma attached to any involvement with the group, are encouraging some civilians to share information with Iraq’s security services, according to residents. The fighters’ immediate, and sometimes more distant, relatives are frequently blocked from returning home to their villages. 

“In 2013 and 2014, it’s now clear that many people did not fully understand what ISIS was or how it was meaningfully different to other groups opposing the state,” Heller said. “Now, a lot of these same communities have collectively expelled [anyone] with a perceived link.”

Along the road to Qaim, the scars left by earlier battles with the Islamic State are visible. Life has trickled back into some towns, but others remain ghostly quiet, homes and businesses reduced to rubble by airstrikes. Many people are missing, and their families are not sure whether they are alive or dead.

“The people of Anbar are keener than even the government not to return to life under ISIS,” said Sheikh Ahmed al-Sanad, a community elder, reached by phone. 

But in its propaganda, the Islamic State remains steadfast. “The war is not finished yet,” said the narrator of a gruesome video released last month, which included footage of nighttime assassinations. “There are many chapters between us and you, and they will be written with blood.”