When Barack Obama vowed to attack Bashar al-Assad, several thousand jihadists on the plains of northern Syria knew exactly what to do. Ever since, they have been hiding their big guns, evacuating bases, parking cars in cow sheds and spreading themselves thin among farms, factories and the communities that reluctantly host them.

"We have learned the lessons from Iraq," said Abu Ismail, a leader of the main jihadist group in the north-east of the country, known to some now as the Islamic state of Iraq and Syria (ISIS). "Iraq has made us better fighters."

While Syria's mainstream rebels are enthusiastically welcoming talk of an American attack as a chance to break the stalemate, the jihadist groups among them see things through a very different prism, in which my enemy's enemy is not necessarily my friend.

All across the north, al-Qaida and its affiliates are on a war footing; a rank and file convinced that an old foe is coming their way and that if and when the US air force does attack, they will have little trouble staying out of its way.

"There are many among us [who] fought in Iraq and Afghanistan," said a second jihadist, a 26-year-old softly spoken Saudi, who called himself Abu Abid. "Our emir knows how to deal with them. And all know that while the Americans say they want to attack the regime, we are their real enemy."

Abu Abid was speaking inside a roadhouse east of Aleppo, where he and other jihadists whom he says "come from every country you could imagine" gather to eat, and drink tea or coffee.

Dressed in an olive green dishdasha and turban, draped with a cow leather ammunition belt, he would have been an oddity in most other Syrian restaurants. But not here, where prim waiters move efficiently between tables of bearded strangers dressed for jihad; some in black pants and gowns, others wearing billowing robes and bandanas.

Kalashnikovs are laid across tables next to salt and pepper shakers, which the waiters gently rearrange to serve plates of grilled chicken and salads. "Let him have it," joked one hulking Libyan as a waiter shifted a rifle to find space for a plate of hummous. "We can take him outside and show him how to use it."

The four men around him, jihadists from elsewhere in the Arab world, laughed among themselves and looked around to see another group enter. They too had come from far away for jihad — first against the Assad regime and now the US, again.

At a table down the hall, a group of Free Syrian Army fighters were enjoying a late lunch beside an olive grove, wondering out loud what regime targets the US would go for and revelling in the discomfort of the jihadists, whom they felt had ridden roughshod over their war in recent months. "I don't care if the Americans attack them too," said one of the men, whose unit has been joined by the jihadists in several battles. "I'd like that in fact. They need to be scared of someone." The table erupted in laughter, before the men calmed themselves. "I hope the Americans know where their headquarters are," said one.

Business is better at the restaurant than at any point since the start of the civil war, said the owner, who did not want to be named. "They are always polite and they always leave a tip. They just don't want the narghilas (water pipes smoked by locals) anywhere near them."

Outside a recently empty car park is crawling with trucks. The highway, for much of the past year as long, straight and empty as an airport runway, is a bustling thoroughfare of dilapidated trucks and clapped out motorbikes – the favourite form of transport for jihadists and regular fighters alike, who ride in pairs, guns slung across their backs.

The highway leads past a bomb-pocked concrete plant to the town of al-Bab, roughly 25 miles north-east of Aleppo and an opposition stronghold for the past 14 months. Here the evolution of Syria's civil war is written in paint on the walls of schools, civic buildings and advertising hoardings, hijacked by myriad players intent on leaving their mark.

The black banner of al-Qaida, adopted by ISIS, is more prominent in al-Bab than the gold-edged flag of the other al-Qaida-linked group, Jabhat al-Nusra, or the regular units of the Free Syrian Army.

"We don't like it this way," said a local man, Abu Nashat, pointing at a school wall that had been white-washed and then emblazoned with two giant al-Qaida logos. "But who is going to take them on over a tin of paint? We already have a big fight on our hands against the regime. Opening a new battle is not something to do lightly."

Behind two wrought-iron gates was the ISIS command centre, emptied of most of its men before the anticipated air strikes. Two young boys stood guard, their heads swathed in bandanas, their pants cut at ankle length in the manner of the men they emulate.

New-found authority resonates from the commandeered schoolyard. And ISIS members have not been shy in asserting their will here, or elsewhere in northern Syria, where an internecine struggle is in danger of eclipsing the reason for the war. "They think everyone who doesn't think and act like them is an infidel who needs to be punished," said a young fighter from the Liwa al-Tawheed Brigade – a mainstream militia – who ran a clothes shop before the conflict. "While they may have learned how to fight the Americans, they haven't learned anything else from Iraq."

One lesson from Iraq, however, is embraced by many Syrians: the Awakening Movement, also known as the Sahawa, that drove al-Qaida out of Anbar province in 2007.

"We need the same thing here," said a senior member of the Liwa al-Tawheed. "They want to kidnap this revolution. Maybe they already have. But don't mistake all the black flags you see for community support. We just don't have the stomach to fight them now. And who could we hope to support us even if we did? America? Europe? Shame on them. Do they not see that Syria will drag down the whole Middle East?"

ISIS's leader, Abu Ismail sees little threat from an Awakening Movement in Syria. Himself an Iraqi, a veteran of al-Qaida's operations in his homeland, he said: "We are good with the people here. If an emir does something wrong he will be punished according to the sharia too. There is not one rule for us and one for the people. A Sahawa is not something that we think about."

When the Guardian spoke to Abu Ismail last November he was a new arrival to the Liwa al-Tawheed, which, though Islamic, fights for a new leadership in Syria and broadly embraces the worldview of the Free Syrian Army. With his new status as local emir, or prince, he claims that momentum for a regional jihad – which aims to install a strict interpretation of sharia law and create a caliphate on a crumbling nation state – is building. "If you control this part of Syria, you control all the Middle East," he said.

"The fight here is more difficult than Iraq. We have the regime, Hezbollah, the Lebanese army, the Shabiha, the Shia mercenaries, Iran, all of them fighting us. And now maybe the Americans. We know how to defeat their air force. We know how to manoeuvre and hide from them. Their number one goal is to prevent the mujahideen getting access to strategic weapons. The planned attack on Assad is a pretence to attack us."

In Aleppo city, where the influence of ISIS has also risen – at the expense of rival jihadist group, Jabhat al-Nusra – preparations are well underway for a US strike. Outside the group's main base – which ISIS took over from al-Nusra in May – a fighter sat on an anti-aircraft gun truck, two turrets pointing towards a vacant blue sky. Two other men pushed children away from a corner near what the group calls its green zone. More fighters were hidden behind canopies and car wrecks near by.

As Obama ponders, al-Qaida and its affiliates are less visible in the north than recently. Checkpoints they set up on main roads are empty now or manned by cadres who do very little checking. "What emerges after the Americans are finished with Bashar and maybe al-Qaida will tell us whether we are on our own until we perish," said the Liwa al-Tawheed leader. "Or whether the world now knows that if either of these two win, we all lose."

He looked into his hands, inhaled deeply and asked: "Do you think we should evacuate our homes too? We hear a lot of talk about drones. Maybe the Americans truly don't know who their friends are. To them, we are all the same. People to demonise and ignore."