You only have to look at the ruined towns northeast of the Syrian city of Aleppo to understand what happened in Iraq's Mosul.

The names of "martyred" fighters line the walls, alongside invocations to obey Sharia law, through miles of crumpled buildings, rubble and unexploded ammunition.

"These people use different names, so if one is defeated the other can claim victory," says Col. Mohamed Saleh of the Syrian army as he surveys the wreckage of a factory in which 27 of his soldiers were killed.

"They call themselves ISIL, al-Nusrah Front, Deach, but they are all the same."

These very same jihadis — which the Syrian forces have been defeating — are now surging towards Baghdad, some of them, perhaps, the very same men who fought Bashar al-Assad's regime in northern Syria.

Here in Aleppo, the rebels trying to hold on to this massive industrial zone — turned into a fortress with underground tunnels built by al-Qaeda insurgents — killed themselves with suicide belts when Col. Saleh's men attacked. This is the kind of intense dedication to the cause that Iraq is now facing.

IRAQ-SECURITY/

Fighters of the Islamic State of Iraq and Syria (ISIS, sometimes known as ISIL) celebrate after confiscating left-behind vehicles from Iraqi security forces in Mosul, Iraq's second-largest city, last week. (Reuters)

The Islamic fighters trumpeting their march south to Baghdad this weekend cut their teeth in the Syrian war.

For the past two years, they have fought their way into the suburbs of Damascus — capturing Idlib and Raqqa, and laying siege to the cities of Homs and Aleppo — just as they have now captured Iraq's second-largest city, Mosul.

Their aim: to establish an Islamic state across both Iraq and Syria, hence the name ISIS (though some call them ISIL for the Islamic State of Iraq and Levant, one of the initial translations). In their wake you find religious slogans on the walls of the captured cities in both countries where they have tried to enforce an extreme version of Sharia law.

Joining the fight against Assad's regime, alongside other opponents of the Baathist leader, gave them access to battlefields — "training grounds" — as well as weapons and communication equipment, some of it provided by the Western governments that support some of the rebels in Syria.

Captured weapons include Turkish radios, Belgian and Russian rifles, and Swedish explosives.

'An elite army'

In contrast to the defeats afflicting the U.S.-backed Iraqi government, the Syrian regime has been pushing back the jihadis in recent weeks. In May, it forced the last of the rebel defenders to surrender the city of Homs in central Syria.

"We're not fighting one battle, but many battles," says Col. Suheil Hassan of the Syrian Army. His forces ended the rebel siege of Aleppo earlier this year, taking back more than 250 kilometres of enemy-held territory. But his speech is punctuated by the continuous sound of mortar fire — a reminder that the battle for Aleppo is far from over.

SYRIA-CRISIS

A woman with her children flee a site hit by what activists said was a vacuum bomb dropped by forces loyal to Syria's President Bashar al-Assad, in the Tariq al-Bab neighbourhood of Aleppo in June 2014. Much of the city is now in rubble after almost three years of fighting. (Mahmoud Hebbo / Reuters)

"They've been trying to take back these areas, so they attack our position everyday," he says.

"Earlier in the war, we underestimated their sophistication in fighting, their manpower, their military capability and weapons," says another officer, who shows me around the industrial town, now a wasteland.

Discarded anti-aircraft shell cases, cartridges and missile parts lie in the rubble and surrounding fields.

"We're fighting an organized army, an elite army, with advanced weapons."

The shifting frontline

The jihadi plan was to take over all of northern Syria — including Latakia, Hama, Idlib and Raqqa — and turn it into an Islamic state. Now, forced to flee parts of Syria, the frontline has shifted inexorably to Iraq, with some predictable consequences.

In Syria, these al-Qaeda-affiliated groups outbid each other in acts of cruel violence, from mass killing to symbolic acts of beheading and — literally — eating the heart of a government officer on camera.

They deliberately wished the world to see their ability to be brutal and uncompromising.

Syrian soldier

A Syrian soldier descends a set of stairs in June 2014 to inspect the al-Qaeda-constructed tunnels beneath an industrial park in Aleppo, which the group known as ISIS, the Islamic State of Iraq and Syria, were using as a base. (Nelofer Pazira / CBC)

So it should come as no surprise that the disintegrating and dysfunctional Iraqi army are fleeing in the thousands, ceding hundreds of square miles of Iraqi territory to ISIS.

In Syria, though, the group learned at least one valuable public relations lesson. In some of the areas it lost to the Syrian army, the local population had revolted against ISIS and the al-Nusra Front. Even though Syrian civilians had suffered under Assad's rule, they appeared to prefer the ruthless Syrian government over the establishment of an Islamic caliphate.

That is why the ISIS leadership is now calling on the people of Mosul not to flee their homes, promising they won't be harmed by Islamist fighters. Though this promise seems to be falling on deaf ears.

ISIS's Syria strategy also shows how the militia turns populated residential areas into military bases where its fighters can move between buildings and alleyways smashed through walls. They dig tunnels and operate from what is in effect an underground city.

Outside Aleppo, they packed explosives into a captured Syrian army tank and drove it to break through the wall of a massive prison. Even discarded metal is turned into an assortment of homemade weapons.

Ultimately, the battle strategy is not to surrender. So the militias who perfected these tactics — improving their fighting capability in the war against Assad's regime — have now turned them against the American-installed Iraqi government, and America-trained Iraqi army.

From the outskirts of Syria's Aleppo and Raqqa all the way to Mosul, ISIS controls territory with a force made up of many Muslim nationalities but fighting along sectarian, in its case Sunni, religious lines.

Ironically, it is America's Arab Gulf allies — all Sunni states — which have been bankrolling these rebels who are now proving themselves to be so great a threat to the entire region.