U.S.-backed fighters in Syria declared victory over Islamic State on Saturday, marking the apparent end of a years-long global campaign to break the extremist group's hold on the region.

The capture of ISIS' last, tiny enclave in the country's south brings its self-proclaimed caliphate to territorial defeat.

"Syrian Democratic Forces declare total elimination of so-called caliphate" spokesman Mustafa Bali said on Twitter early Saturday.

Syrian Democratic Forces declare total elimination of so-called caliphate and 0 territorial defeat of ISIS. On this unique day, we commemorate thousands of martyrs whose efforts made the victory possible. #SDFDefeatedISIS — Mustafa Bali (@mustefabali) March 23, 2019

The battle for Baghouz, the group's last holdout and all that remained of the vast territory that it once ruled in Syria and Iraq, had dragged on for more than 10 weeks — far longer than either the U.S. military or their allies on the ground had predicted.

President Donald Trump has been teasing the victory for days.

Trump shows a map which he said indicates the end of ISIS, as he arrives at Palm Beach International Airport in Florida on March 22, 2019. NICHOLAS KAMM / AFP - Getty Images

On Friday, the White House said the Department of Defense had declared that the militant group no longer held any territory in Syria. At around the same time, Trump tweeted that there was "nothing to admire" about ISIS.

The militants, meanwhile, had been putting up a desperate fight, and the American-backed Syrian Democratic Forces supported by U.S.-led coalition airstrikes had held off declaring victory.

At a victory ceremony near Baghouz on Saturday, a brass band in red and gold uniforms played the American national anthem in front of a stars and stripes flag and yellow militia banners. SDF leaders including both men and women sat watching.

The SDF had repeatedly paused its final push to capture the village in order to allow more than 30,000 civilians, many of them the wives and families of foreign fighters, to be evacuated.

Bali said they had caught several militants trying to flee among the civilians. Others had handed themselves over.

Their fate has befuddled foreign governments, with few ready to repatriate citizens who pledged allegiance to a group sworn to their destruction, but who might be hard to legally prosecute.

Trump has called on European countries to take back captured Islamic State fighters currently in U.S. custody as the military prepares for a withdrawal.

But a full withdrawal is looking less certain despite the fall of ISIS.

Trump recently told members of Congress in a letter obtained by NBC News that he now agrees "100%" with keeping a military presence in Syria.

It's a major shift from Trump's announcement of a full withdrawal in December, which blindsided U.S. allies as well as many in Washington and prompted the resignation of then-Defense Secretary Jim Mattis.

U.S.-backed Syrian Democratic Forces (SDF) fighters pose for a photo on a rooftop overlooking Baghouz, Syria, after the SDF declared the area free of Islamic State militants after months of fighting on March 23, 2019. Maya Alleruzzo / AP

"We have won against ISIS. We have beaten them and we have beaten them badly," Trump said in a December video posted on Twitter. "We have taken back the land and now it's time for our troops to come back home."

The White House has since said that a peacekeeping group of about 200 troops will remain in Syria "for some period of time."

In the recent letter reiterating that presence, Trump said, "[We] seek to ensure that all of the gains made in Syria are not lost, that ISIS never returns."

The move appears to heed warnings that the symbolic end of Abu Bakr al-Baghdadi's deathly project may not mean the threats posed by ISIS will cease.

A senior U.S. diplomat said Saturday the territorial defeat of the group is a "critical milestone" that delivers a crushing and strategic blow to the extremist group.

However William Roebuck, the State Department's official in charge of Syria, added that the campaign against ISIS is not over, saying the group remains a significant threat in the region.

"We still have much work to do to achieve an enduring defeat," Roebuck said at a ceremony in eastern Syria's al-Omar oil field base.

A recent Pentagon report found the group could reclaim territory in months and is currently regrouping in Iraq faster than in Syria, underscoring the fluid nature of the security situation in the Middle East.

"Currently, ISIS is regenerating key functions and capabilities more quickly in Iraq than in Syria, but absent sustained [counterterrorism] pressure, ISIS could likely resurge in Syria within six to 12 months," according to the Department of Defense Inspector General Quarterly Report about Operation Inherent Resolve.

The U.S. believes Baghdadi, the group's leader, is in Iraq. He stood at the pulpit of the great medieval mosque in Mosul in 2014 to declare himself caliph, sovereign over all Muslims.

The group no longer controls any territory in Syria or Iraq, but continues to carry out insurgent attacks in both countries. It also maintains affiliates in Egypt's Sinai Peninsula, Afghanistan and elsewhere.