Over the past few months, as the size of the Islamic State’s caliphate rapidly shrunk, the Pentagon began citing the number of enemy dead as an important barometer of longer-term success. “We have killed, in conservative estimates, sixty thousand to seventy thousand,” General Raymond Thomas, the head of U.S. Special Operations Command, told the Aspen Security Forum, in July. “They declared an army, they put it on the battlefield, and we went to war with it.”

A high kill rate, which once misled the U.S. military about its prospects in Vietnam, has eased concerns in the U.S. today about future attempts at revenge from ISIS’s foreign fighters. “We’re not seeing a lot of flow out of the core caliphate, because most of those people are dead now,” Lieutenant General Kenneth McKenzie, Jr., the director of the Pentagon’s Joint Staff, confidently told reporters this month. “They’re unable to manifest the former activities they did to try to pose themselves as a state.”

Yet the calculus is pivotal now that the ISIS pseudo-caliphate has collapsed: Just how many fighters have survived? Where are they? What threat do they pose? Between 2014 and 2016, the perpetrators of all but four of the forty-two terrorist attacks in the West had some connection to ISIS, the European Commission’s Radicalization Awareness Network said, in July.

A new report, to be released Tuesday by the Soufan Group and the Global Strategy Network, details some of the answers: At least fifty-six hundred people from thirty-three countries have already gone home—and most countries don’t yet have a head count. On average, twenty to thirty per cent of the foreign fighters from Europe have already returned there—though it’s fifty per cent in Britain, Denmark, and Sweden. Thousands more who fought for ISIS are stuck near the borders of Turkey, Jordan, or Iraq, and are believed to be trying to get back to their home countries.

Dozens of governments face similar challenges. Earlier this year, President Vladimir Putin acknowledged that ten per cent of the more than nine thousand foreign fighters from Russia and the former Soviet republics who went to Syria or Iraq have come home. (In private, other Russians have given me higher numbers.) The report, titled “Beyond the Caliphate: Foreign Fighters and the Threat of Returnees,” notes that countries in Southeast Asia, such as the Philippines, and in North Africa, such as Libya, are particularly vulnerable. Not only are citizens returning to these nations, so are other foreign fighters who have been forced out of the caliphate and are unable or unwilling to go home. Hundreds of jihadis are believed to be searching for new battlefields or refuge in Muslim countries.

The Islamic State’s future may increasingly depend on the returnees, the report warns. “As the territorial caliphate shrinks and is increasingly denied an overt presence, its leadership will look to supporters overseas, including returnees, to keep the brand alive,” it says. For the jihadis themselves, the psychological impact of their past ISIS experience and their uncertain futures may be as pivotal as any ideological commitment in determining what they do next. ISIS “has tapped into deep veins of disillusion with traditional politics and mistrust of state institutions,” the report notes.

“Most returnees will be unlikely to experience anything in their lives at home that matches the intensity of their experience as a member of IS, whether or not they were fighting on the front line,” “Beyond the Caliphate” adds. “Returnees may be particularly vulnerable to contact from people who were part of the network that recruited them, or appeals for help from ex-comrades in arms. It seems probable that the influence and involvement of returnees will grow as their numbers increase.”

Over all, since 2011, more than forty thousand people, from more than a hundred and ten countries, travelled to join ISIS—in addition to the local Syrians and Iraqis who became fighters. Among these jihadis were seventy-four hundred from the West—five thousand of them from Europe.

So far, the numbers of ISIS fighters from the United States have been comparatively low. More than two hundred and fifty Americans tried to leave the country to join the caliphate in Syria or Iraq. About half—a hundred and twenty-nine—succeeded, the report says. Some were blocked. Only seven of those who made it to to the battlefield have returned. As of August, the United States has charged a hundred and thirty-five people for terrorism offenses linked to ISIS; seventy-seven have so far been convicted.

In Europe, the potential threat from returnees has already been visible. “The terrorist attacks in Brussels in May 2014 (Jewish Museum) and March 2016 (airport and metro station), as well as the multiple attacks in Paris in November 2015, were all atrocities perpetrated to some degree by returnees,” according to the Radicalization Awareness Network. In Paris, at least six of the perpetrators had returned from Syria, while three out of the five Brussels attackers were returnees. Terrorist attacks don’t require a lot of manpower.

U.S. officials counter that the fall of Raqqa, the Syrian city that served as the caliphate’s nominal capital, diminished ISIS’s ability to plot and coördinate attacks abroad. ISIS has lost more than a hundred and twenty of its leaders. It is now in survival mode. Most of the fighters still in theatre—estimated to be somewhere between six thousand and ten thousand—have fled to desert refuges in the Euphrates River Valley.

Among those who are left, the networks created—either formally by ISISor informally among the fighters, through language or national ties—will be critical to the future. Initially, the leaders of the embryonic ISIS, including its caliph, Abu Bakr al-Baghdadi, emerged from networks forged when they were imprisoned together in Camp Bucca and Abu Ghraib prisons, both of which were run by the U.S. military in Iraq. A decade later, the caliphate was born.

The co-sponsors of “Beyond the Caliphate” have ample experience in tracking terrorism. The Soufan Group, a nonprofit organization, is headed by Ali Soufan, a Lebanese-American and a former F.B.I. agent. Once the only Arabic speaker in the largest F.B.I. field office, in New York, he was the first to warn about Al Qaeda’s intention to launch a major attack on the United States. It was, at the time, little heeded. The Global Strategy Network is headed by Richard Barrett, the former director of global counterterrorism operations at Britain’s M.I.6 and the former coördinator of the U.N. Al-Qaeda Taliban Monitoring Team.

To put the numbers in perspective, Soufan told me on Sunday, ISIS amassed more than four times as many fighters as the Afghan Arabs—Arab men who joined the fight against the Soviet occupation of Afghanistan between 1979 and 1989. After the Soviets withdrew from Afghanistan, the remnants of the Afghan Arabs, led by Osama bin Laden, went on to form Al Qaeda—and launched the deadliest attack on American soil since Pearl Harbor.

“The total number then was only about ten thousand, and look what havoc they caused,” Soufan said. ”Compare that to more than forty thousand today—with their ability to communicate today.”

Tracking the ISIS jihadis was initially tough. They sneaked, or were smuggled, across borders. They didn’t declare their intent; they wore black masks in ISIS videos and social media. Their accents were often the only clue to where they came from. The accent was one of the main pieces of evidence in identifying Mohammed Emwazi, better known as the notorious ISIS executioner “Jihadi John.” Like the Nazis, however, ISIS kept meticulous records of its personnel, their applications, their histories, and their deployments, the report notes. Thousands of pages were recovered in the military campaigns after ISIS fled key cities, U.S. officials told me. Captured computers and cell phones, laden with data and contacts, have helped the U.S.-led coalition build a global profile of ISIS members and sympathizers. Nineteen thousand names have been shared with Interpol to put on a watch list.

In looking ahead, the report concludes that “anyone who wishes to continue the fight will find a way to do so.” Some may opt to join one of the three dozen ISIS “provinces.” The group’s wings in Egypt’s Sinai, Libya, and Afghanistan are now among the most active. ISIS still has a psychological edge, too, despite losing most of its territory. In August, the Pew Research Center released a poll on global threats. Respondents in thirty-eight countries ranked ISIS at the top of the list—followed by climate change, cyberattacks, the global economy, refugees from Syria and Iraq, and the growing influence of the United States, Russia, and China.