For three years, terrorists controlled a huge stretch of territory in Iraq and Syria. They ran their own state, collecting tens of millions of dollars in taxes and using the proceeds to fix potholes, issue birth certificates, finance attacks and recruit followers from around the world.All but 1 percent of that territory is now gone, which has prompted the White House to describe the Islamic State as “wiped out,” “absolutely obliterated” and “in its final throes.” But to suggest that ISIS was defeated, as President Trump did when he announced plans to pull out American troops from Syria, is to ignore the lessons of recent history.The group has been declared vanquished before, only to prove politicians wrong and to rise stronger than before.The attack last week by a suicide bomber outside a shawarma restaurant in the Syrian city of Manbij, which killed at least 15 people including four Americans, is one example of how the group still remains a serious, violent threat.“People make the mistake of thinking that when you lose territory, it’s linear — that they will continue to lose,” said Seth G. Jones, a senior adviser at the Center for Strategic and International Studies and the author of the center’s recent study assessing ISIS’ troop strength.“When you lose territory, smart groups shift to guerrilla strategy and tactics, including targeted assassinations, ambushes, raids, bombings,” he added. “That is how you wear the enemy down.”Mr. Trump’s declaration that ISIS has been defeated is the second time the group has been described this way.A decade ago, the group then known as the Islamic State of Iraq had been pummeled so hard that officials estimated it was down to its last 700 fighters. Over one 90-day period, American forces arrested or killed 34 of the group’s top 42 leaders.With his troops exhausted and outnumbered, the emir of the terrorist group privately lamented that they could no longer hold ground.“We now have no place where we can stand for even a quarter of an hour,” the emir, Abu Omar al-Baghdadi, is said to have told his deputies, according to the group’s own account of the period before the American troop withdrawal from Iraq was completed in 2011.But after that withdrawal, the group rapidly rebuilt itself, and just four years later succeeded in seizing a territory the size of Britain.Recent estimates indicate that the Islamic State has more than 20 to 30 times the fighters it had the last time it was left for dead.Although many of its leaders have been killed, the group’s caliph, Abu Bakr al-Baghdadi, and several of his top deputies, are believed to be alive.But the crumbling of the state has made it difficult to recruit and only a trickle of new members are believed to still be heading to the region from overseas, down from the thousands that were crossing into their territory before.Meanwhile, attacks have dropped in certain critical locations, like Iraq. That doesn’t mean the group doesn’t remain lethal there. In 2018 in the months after Prime Minister Haider al-Abadi declared victory over ISIS, the group carried out over 1,200 attacks just in Iraq, according to one data set.Also, the group’s acolytes continue to kill around the world, including last month in one of Europe’s Christmas markets, in Strasbourg, France, where a gunman who had left a pledge of allegiance to ISIS on a USB stick killed five people, and on a trail in Morocco’s Atlas Mountains, where a group of men who also had recorded a pledge killed two Scandinavian tourists.With the attack on the Syrian restaurant, the world was again reminded of the group’s ability to carry out deadly attacks.Two American troops were killed in that suicide bombing, doubling the death toll for United States forces killed in combat since the start of their four-year deployment to Syria.“Everyone knows, and we have always said, that the battle against ISIS has not ended, the danger of ISIS has not ended,” said Shervan Darwish, the spokesman for the Manbij Military Council, where the attack occurred. “ISIS still has power, still has cells and it is working to reorganize its ranks.”Three different reports released late last year — by the Pentagon inspector general, the United Nations and the Center for Strategic and International Studies — estimated that ISIS has 20,000 to 30,000 members in Iraq and Syria alone.Those figures do not account for the thousands of fighters based in the caves of Afghanistan, in the scrubland of Niger and Mali, in the Sinai Desert, in lawless stretches of Libya and Yemen, and in the numerous other countries where affiliates of the group have taken hold.Online, the terror group has repeatedly boasted about how the United States’ pullout is evidence that the Islamic State has outlasted the American operation.In one video narrated by a well-known ISIS propagandist, Turjman Aswarti, the terror group brags that they are stronger now than the last time American forces withdrew.“When Obama announced America’s flight from Iraq, the fire of our war was only burning in Iraq,” he says, according to a translation provided by the SITE Intelligence Group, which monitors extremist content. “Today the flames of war are still burning in Iraq, Syria, Afghanistan, Yemen, Sinai, East Africa and Libya,” he said, naming the other countries where ISIS affiliates have flourished.“It’s pretty obvious that the group today is vastly more powerful than the Islamic State of Iraq was then,” said Brian Fishman, a former director of research at the Combating Terrorism Center at the United States Military Academy in West Point and the author of book on the rise of ISIS.Experts say the White House is mistakenly equating the group’s shrunken territorial holdings with its overall strength.From its peak four years ago, when it held almost half of Syria and a third of Iraq, the Islamic State has now lost all but a fraction of the land it once held in the region.But it has made a tactical shift to a guerrilla strategy, as Mr. Jones of the strategic and international studies group described it.ISIS announced this tactical shift as early as 2017, in an article in Naba, its weekly newsletter, said Hassan Hassan, a senior fellow at the Tahrir Institute for Middle East Policy in Washington.In the newsletter, the Islamic State compared its situation now with the tatters it was in before the last American pullout.“It became impossible in early 2008 to continue the fight in its conventional ways,” ISIS said in the essay.The essay explained that fighting detachments were abolished and the group’s remaining fighters were all trained in using improvised explosive devices.“Instead of clashing with the heavily equipped American Army, compared to our small and underequipped one, the fight took an absolutely new shape,” the article said.At the height of its territorial power, ISIS resembled a conventional army, at times rolling into battle with T-55 tanks.Mr. Hassan has argued the group began the transition back to an insurgency as far back as 2016, a full year before it lost the most important center under its control — the Iraqi city of Mosul.Mr. Hassan documented how, in early 2016, the group stepped up hit-and-run attacks in towns it had lost. These hasty operations appeared aimed at inflicting harm on these towns’ new rulers, with no intention of regaining territorial control.Michael Knights, a senior fellow at the Washington Institute for Near East Policy, documented how throughout Iraq the group has focused with laserlike precision on killing “moktars,” or village chiefs, as well as tribal elders and local politicians.There were, on average, 15 assassination attempts against local leaders each month in the first 10 months of 2018, by Mr. Knights’ count.These targeted assassinations drew little coverage in the international news media, and yet they have helped undercut the trust Iraqis place in their government’s ability to protect them — as well as drive young men back into ISIS’s fold, Mr. Knights said.“If ISIS can come to your town and kill the most important person in your town any night of the year, do you feel you’ve been liberated?” he asked.The group’s current tactics mirror ISIS’ strategy a decade ago, which led to its rebirth.“They realized you don’t have to mount 6,000 attacks per month,” Mr. Knights said. “You just have to kill the right 50 people each month.”In its own literature, the Islamic State talks about now being in a phase of “rasd,” or surveillance.“They spend time learning the routine of the new security forces in town,” Mr. Hassan said. “They look for security gaps. They look for patterns.”“Once you see gaps, you start working through these gaps,” he added. “They don’t just have a crazy guy run out, start shooting and get killed.”It is in that context that analysts are viewing the deadly attack last Wednesday on American forces in Manbij.With its tiled walls, shiny tables and tasty shawarma sandwiches, the Palace of Princes restaurant had become a favorite haunt of the 2,000 American troops stationed in Syria. They would pop in to pick up takeout orders before heading back on patrol. Other times they parked their armored cars in front and sat at a table.The soldiers seemed to have made little effort to hide their presence or vary their routine to make it harder for enemies to track them.In a newsletter ISIS released shortly after the attack, the group quoted a member of its “emni,” or intelligence and security branch, based inside Manbij, who explained that the militant group had regularly tried to hit American forces in rural Manbij. Their efforts failed until last week.In the article, the ISIS operative explained the surveillance the group had used, saying American forces were positioned at three small bases on the outskirts of Manbij. He said United States troops moved regularly among these bases in convoys of five to 10 armored cars, escorted by guard vehicles belonging to an American-backed Kurdish militia.While it is impossible to verify the claims made in the ISIS newsletter — and the Pentagon has released no further details on the attack — the surveillance described in the article is consistent with what is known about how the group is carrying out its insurgency.He explained that American soldiers entered the city in convoys of Land Cruisers, but rarely appeared outside their armored cars, according to a translation provided by the SITE Intelligence Group, which monitors extremist content.“To conduct an attack like this means that ISIS was conducting intelligence and reconnaissance on the movement of U.S. soldiers and had someone pre-positioned in the city so that once they got info on timing and location they could get someone on the site pretty fast,” said Mr. Jones of the strategic and international studies group. “That means that in Manbij, they have a cell structure.”Mr. Jones said strikes like the one on the American troops require militants to carry out intelligence, build the bomb, transport the bomb and deploy a suicide bomber.“It shows they have a clandestine network,” he said.