A member of the Syrian Democratic Forces flashes the victory gesture in the village of Baghouz in Syria’s eastern Deir Ezzor province near the Iraqi border on Sunday. (Delil Souleiman/AFP/Getty Images)

THE CAPTURE of the last territory controlled by the Islamic State on Saturday was far from a final victory over the movement, as U.S. commanders and diplomats were careful to emphasize. The jihadists retain thousands of fighters in clandestine cells scattered across Syria and Iraq, as well as affiliates in Afghanistan, Egypt, the Philippines, Libya, Burkina Faso and elsewhere. Nevertheless, the final elimination of a self-declared caliphate that once controlled a territory the size of Britain and ruled over as many as 12 million people is worth celebrating. It represents a victory not just for moderate forces in Syria and Iraq, which did most of the fighting, but for a U.S. military mission that succeeded with a light footprint and relatively low costs.

The rapid advance of Islamic State forces across Iraq in the summer of 2014 forced President Barack Obama to reverse his premature withdrawal of U.S. troops from the country. But the campaign that then unfolded in Iraq and later in Syria was dramatically different from the previous, troop-heavy wars in Iraq and Afghanistan. U.S. strategy was to partner with local forces that would take the lead on the ground, including elite elements of the Iraqi army and Kurdish-led forces in northern Iraq and eastern Syria. American troops in Iraq and Syria, mostly Special Operations forces and trainers, numbered in the single-digit thousands.

The biggest U.S. contribution was in air power. The United States and coalition partners carried out nearly 34,000 airstrikes between August 2014 and the end of January 2019, according to the Pentagon. That proved devastatingly effective against Islamic State forces, which had no air force and scant air defenses. By U.S. estimates, 70,000 of 100,000 Islamic State fighters were killed, many of them in airstrikes.

American allies paid a heavy price, as well. The Kurdish-led alliance that fought the jihadists in Syria says 11,000 of its fighters were killed, and Iraqi security forces and militias probably lost at least as many. Large parts of Mosul, Iraq’s second-largest city, were destroyed, as was the Syrian town of Raqqa. Pentagon figures show 1,257 civilians unintentionally killed in coalition airstrikes, a number human rights monitors say is understated.

U.S. losses, in contrast, were remarkably light: Sixteen soldiers and one civilian were killed in action over the past 4½ years, and 58 other “non-hostile” fatalities were associated with the mission. As of the end of last year, the war has cost some $28.5 billion — a fraction of the more than $1.5 trillion price of the ground wars in Iraq and Afghanistan.

In all, the fight against the Islamic State showed that the United States is capable of leading effective foreign counterterrorism campaigns, provided it partners with local forces and focuses on supplying unique U.S. assets, such as intelligence and precision airstrikes. A second lesson is that the costs of playing such a role are far less, in the long run, than withdrawing and allowing terrorist groups to rebuild. It’s not clear whether President Trump accepts that conclusion, but the history of the past decade in the Middle East ought to be persuasive.