BEIRUT — The Islamic State militants came into the Syrian town with a hit list. By the time they left three weeks later, more than 70 civilians had been killed — shot or beheaded, their bodies dumped in farms and ditches.
The apparent revenge killings in the town of Qaryatayn underscore the ability of the extremists to inflict heavy losses even when they’re in retreat — and portend more violence as they fight to hang on to their last strongholds in Syria.
News of the gruesome slayings began to emerge late Sunday, after Islamic State militants were driven out by advancing government troops.
Terrified residents said they watched the slaughter from their windows or in the streets.
One former resident said his surviving family members walked for miles to find cellphone coverage so they could tell him of the deaths of his uncle, two cousins, and a fourth relative. Another uncle remains missing.
‘‘They came into town with a hit list,’’ said Abdullah AbdulKarim, adding that 35 of the 50 militants who overran the town late last month were originally from Qaryatayn. He said the militants accused many of their victims of collaborating with the government but many others were also caught in the revenge killing.
‘‘Our curse is from within us,’’ he said, speaking from northern Syria, where he fled years ago.
Once a predominantly Christian town known for its ancient monastery, Qaryatayn has changed hands between the Islamic State and the Syrian government several times during Syria’s civil war.
Parts of the 1,500-year-old St. Elian monastery were demolished the first time the Islamic State took over the town in 2015 and thousands of its Christian residents fled, fearing the extremist group’s brutality.
After Syrian government troops recaptured Qaryatayn on Saturday, bodies were found lying in the streets.
The Britain-based Syrian Observatory for Human Rights said it had documented the killings of at least 128 people in Qaryatayn, including at least 12 killed by government forces on suspicion of aiding the Islamic State militants.
AbdulKarim and Mohamed Hassan, an activist who runs the Palmyra Network News, put the death toll at 75 civilians, saying many more remain unaccounted for. They said the dead included some who were shot by government forces.
But Hassan said most of the slayings were by Islamic State militants. ‘‘It seems it was mostly revenge,’’ he said.
Another activist network, the Palmyra Coordination Committee, released the names of 67 civilians who were confirmed killed and said the number was likely to rise. It said at least 35 of the dead were found dumped inside a ditch.
Talal Barazi, the governor of Homs province, said the Islamic State ‘‘terrorized’’ residents for three weeks, adding that most of the dead were townspeople who were government employees or were affiliated with Syria’s ruling Baath party.
He said at least 13 residents remained missing and six bodies had not been identified.
Islamic State militants first seized Qaryatayn in August 2015, and relied on its strategic location to defend another of their bastions, the historic city of Palmyra.
With Russian backing, Syrian government troops regained control of Qaryatayn in April 2016. But the Islamic State, facing major setbacks in Syria and Iraq, launched a new offensive on the town in late September and recaptured it.
AbdulKarim said during the three weeks that the Islamic State controlled the town, the militants went door to door looking for people they accused of collaborating with the Syrian government.
He said his uncle, who was a local mayor, and two cousins were shot after they were taken to an undisclosed location. Another uncle remains missing.
‘‘They took people to show them bodies dumped in an open area to let them know they were killed, but also to terrorize the public,’’ AbdulKarim said. He said the extremists barred residents from burying their dead.
He said the advancing government troops also killed civilians, but residents were too afraid to report the government killings.
AbdulKarim and the Observatory said the militants took Qaryatayn’s police chief, his wife, and other security personnel as hostages to negotiate their exit after government troops encircled the town. About 200 militants evacuated the town, before government forces marched in, they said.