QAIM, Iraq — Islamic State militants who escaped the defeat of their self-described 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 during 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.

Those fighters, mostly Iraqis who followed ISIS into Syria, are now returning home to join militant cells that have been digging into rugged rural areas, sustained by intimate knowledge of the local 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 per 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.

ISIS media published grainy videos showing the assassination of paramilitaries 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 earlier 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 ISIS 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 across 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 ISIS caliphate, Mohammed said he had fought in every major battle that 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 ISIS’s caliphate in November 2017, a month after security forces ran the militants out of Qaim, located on the eastern 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 ISIS’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 destination unknown, according to security officials. Some militants travel on foot. More commonly, they snake through the desert in cars, at times detected by surveillance drones and targeted by Iraqi or U.S.-led coalition airstrikes.

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

Describing a recent raid on an ISIS hideout near the western town of Rutba, another senior military official said the helicopter transporting his soldiers was targeted with rocket-propelled grenades even before they 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 speak with the news media.

The ISIS 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 once again can 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 their sweep to power, ISIS 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 local residents. The fighters’ immediate, and sometimes more distant, relatives frequently are 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,” said Heller. “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 ISIS are still 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, ISIS 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.”