BEIRUT (Reuters) - Syria’s army declared victory over Islamic State on Thursday, saying its capture of the jihadists’ last town in the country marked the collapse of their three-year, hardline reign in the in the region.

FILE PHOTO: A Free Syrian army fighter holds his weapon in Jubata al-Khashab in Quneitra province, Syria, November 4, 2017. REUTERS/Alaa Al-Faqir

The army and its allies are still fighting Islamic State in desert areas near Albu Kamal, the last town the militant group had held in Syria, near the border with Iraq, the army said.

But the capture of the town ends Islamic State’s era of territorial rule over the so-called caliphate that it proclaimed in 2014 across Iraq and Syria and in which millions suffered under its hardline, repressive strictures.

Yet after ferocious defensive battles in its most important cities this year, where its fighters bled for every house and street, its final collapse has come with lightning speed.

Instead of a battle to the death as they mounted a last stand in the Euphrates valley towns and villages near the border between Iraq and Syria, many fighters surrendered or fled.

“There’s some fighters left but they’re few. Small numbers is all I can say,” said a Syrian army commander of the remaining militants near Albu Kamal. “Some were killed and some ran away. They went toward eastern or northern villages.”

In Albu Kamal, the jihadists had fought fiercely, said a commander in the pro-Syrian government military alliance. But it was captured the same day the assault began.

This sealed “the fall of the terrorist Daesh organization’s project in the region”, an army statement said, using an Arabic term for Islamic State.

The fate of its last commanders is still unknown -- killed by bombardment or in battle, taken prisoner but unidentified, or hunkered into long-prepared hideouts to plot a new insurgency.

The last appearance of Abu Bakr al-Baghdadi, who declared himself caliph and heir to Islam’s historic leaders from the great medieval mosque in Iraq’s Mosul, was made in an audio recording in September.

“Oh Soldiers of Islam in every location, increase blow after blow, and make the media centers of the infidels, from where they wage their intellectual wars, among the targets,” he said.

Mosul fell to Iraqi forces in July after a nine-month battle. Islamic State’s Syrian capital of Raqqa fell in October to the Syrian Democratic Forces (SDF), a U.S.-backed alliance of Kurdish and Arab militias, after four months of fighting.

But all the forces fighting Islamic State in Syria and Iraq expect a new phase of guerrilla warfare, a tactic the militants have already shown themselves capable of with armed operations in both countries.

Western security chiefs have also said its loss of territory does not mean an end to the “lone-wolf” attacks with guns, knives or trucks plowing into civilians that its supporters have mounted around the world.

MIDDLE EAST CHAOS

As it did after previous setbacks, Islamic State’s leadership may now stay underground and wait for a new opportunity to take advantage of the chaos in the Middle East.

It might not have long to wait. In Iraq, a referendum on independence in the northern Kurdish region has already prompted a major confrontation between its autonomous government and Baghdad, backed by neighboring Iran and Turkey.

In Syria, two rival campaigns raced across the country’s east this year driving back Islamic State -- the Syrian army backed by Russia, Iran and Shi’ite militias, and an alliance of Kurdish and Arab militias backed by the United States.

Syrian officials and a senior advisor to Iran have indicated the Syrian army will now stake its claim to Kurdish-held territory. Washington has not yet said how it would respond to a protracted military campaign against its allies.

Aggravating tensions -- and raising the possibility of turmoil from which Islamic State could benefit -- is a contest for power between Iran and Saudi Arabia.

It has developed a religious edge, pitting Shi’ite groups supported by Iran against Sunni ones backed by Saudi Arabia, infusing the region’s wars with sectarian hatred.

A senior Iranian official this week spoke from Syria’s Aleppo of a “line of resistance” running from Tehran to Beirut, an implicit boast of its region-wide influence.

In recent days the rivalry has again escalated as Riyadh accused Lebanese Hezbollah of firing a missile from the territory in Yemen of another Iranian ally, the Houthi movement.

Hezbollah is a critical part of the Tehran-backed alliance helping Syrian President Bashar al-Assad. Hezbollah fighters played the key role in ousting Islamic State from Albu Kamal, a commander in that alliance told Reuters.

ISLAMIC STATE’S FALLEN ‘STATE’

Baghdadi’s declaration of a caliphate in 2014 launched a new era in jihadist ambition. Instead of al Qaeda’s strategy of using militant attacks against the West to spur an Islamist revolution, the new movement decided to simply establish a new state.

It led to a surge in recruitment to the jihadist cause, attracting thousands of young Muslims to “immigrate” to a militant utopia slickly realized in propaganda films.

Islamic State’s leadership ranks included former Iraqi officials who well understood the running of a state. They issued identity documents, minted coins and established a morality police force.

Unlike previous jihadist movements that relied on donations from sympathizers, Islamic State’s territorial grip gave it command of a real economy. It exported oil and agricultural produce, levied taxes and traded in stolen antiquities.

On the battlefield, it adapted its tactics, using heavy weaponry captured from its enemies during its first flush of military success, adding tanks and artillery to its suicide bombers and guerrilla fighters.

It imprisoned and tortured foreigners, demanding ransoms for their release and killing those whose countries would not pay in grotesque films posted online.

The number of those treated in this way was as nothing to the multitude of Syrians and Iraqis Islamic State killed for their behavior, words, sexuality, religion, ethnicity or tribe. Some were burned alive, others beheaded and some dropped from the roofs of tall buildings.

Captured women were sold as brides at slave auctions. But as Islamic State was pushed from territory in recent months, there were pictures of women pulling off face veils and smoking previously banned cigarettes.