BEIRUT — The grinding battle to clear the Islamic State’s final pocket of territory in eastern Syria has been slowed by a mystery: No one knows how many people are still trapped inside.

With the militants pinned down in a dusty hamlet, the U.S.-backed forces surrounding them have seen their estimates upended day by day. While the Syrian Democratic Forces (SDF) maintain that the extremists’ cadres are down to the hundreds, some 6,000 people have emerged over the past week. According to one European estimate, Western military planners have been operating on the assumption that as many as 10,000 people may have remained there.

Fighters and civilians alike are being grilled about what they saw as they left.

“Really, we have no idea; it’s like they’re coming out of nowhere,” said one SDF commander Monday, speaking on the condition of anonymity because he was not authorized to speak to the media. “We’ve never seen anything like this.”

Video footage of the Islamic State’s final sliver of territory last week showed fighters milling around with guns in hand and faces covered. At the end of the four-year U.S.-led fight to push them out of a territory the size of Kansas, all that remained above ground was a gathering of tents and a few buildings.

The earth in between appeared to be pocked with entrances to tunnels where hundreds — or thousands — of remaining inhabitants are believed to be hiding.

“Most of them live in underground basements and tunnels,” said Adnan Afrin, a spokesman for the SDF near Baghouz, the village still held by the Islamic State. “According to the information from the civilians who came out, the number of fighters exceeds 1,000.”

The lull in the fighting has allowed Islamic State militants and their families to stream out of the area, before being trucked off to prisons and sprawling displacement camps in Syria’s northeast.

Tens of thousands of foreign fighters joined the Islamic State’s self-declared caliphate at its peak, and while many have returned home, some of the most die-hard have been among the thousands surrendering into SDF custody this month.

The area’s Kurdish authorities have called upon Western countries to take back their citizens, with little success. Governments fear that battle-hardened militants will provide complex security challenges upon their return, and European residents have shown little appetite to welcome them back, either.

At least 800 foreign fighters remained in Kurdish custody last month, according to the SDF’s top foreign relations official, ­Abdelkarim Omar.

That number is expected to increase significantly when a final count is tallied after the battle for Baghouz.

 “The international community is still evading their responsibility,” Omar said, stressing that the SDF and its forerunner, the Kurdish People’s Protection Units, had suffered more than 8,000 combat deaths and thousands more casualties in the fight against the Islamic State.

“Many terrorist attacks could have happened in different European cities had we not fought fiercely against [the Islamic State] in Syria. Now, we need the help of the international community,” he said.

The Iraqi army says it has taken scores of its nationals from the Islamic State into custody in recent days. One senior military official, speaking on the condition of anonymity because he was not allowed to speak to the media, said the SDF had also handed over 15 French nationals, one of whom was dead upon arrival.

He said they had been transferred to Baghdad for trial.

Aid groups have been overwhelmed by the outflow of civilians from Baghouz over the past week. The Kurdish ANHA news channel reported that more than 20 pickup trucks, carrying about 1,300 people, had arrived at the al-Hol displacement camp Monday. Most were women and children.

The camp is already over capacity and without enough tents to hold the families who arrived weeks ago, let alone in recent days. Dozens of infants have died on the hours-long drive to al-Hol, with death certificates seen by The Washington Post stating the cause of death as pneumonia.

Tensions among al-Hol’s residents are also simmering. “Syrians and Iraqis are being kept apart, and other foreigners, too,” said Hamreen al-Hassan, one of the camp’s managers. “We can’t kick these people out, but what do you expect from us? How do we bear this burden?”

Mustafa Salim in Baghdad and Zakaria Zakaria in Istanbul contributed to this report.