Not far from Mosul, a large military force is finalising plans for an advance that has been more than three decades in the making. The troops are Shia militiamen who have fought against the Islamic State, but they have not been given a direct role in the coming attack to free Iraq’s second city from its clutches.

Instead, while the Iraqi army attacks Mosul from the south, the militias will take up a blocking position to the west, stopping Isis forces from fleeing towards their last redoubt of Raqqa in Syria. Their absence is aimed at reassuring the Sunni Muslims of Mosul that the imminent recapture of the city is not a sectarian push against them. However, among Iraq’s Shia-dominated army the militia’s decision to remain aloof from the battle of Mosul is being seen as a rebuff.

Yet among the militias’ backers in Iran there is little concern. Since their inception, the Shia irregulars have made their name on the battlefields of Iraq, but they have always been central to Tehran’s ambitions elsewhere. By not helping to retake Mosul, the militias are free to drive one of its most coveted projects – securing an arc of influence across Iraq and Syria that would end at the Mediterranean Sea.

The strip of land to the west of Mosul in which the militias will operate is essential to that goal. After 12 years of conflict in Iraq and an even more savage conflict in Syria, Iran is now closer than ever to securing a land corridor that will anchor it in the region – and potentially transform the Islamic Republic’s presence on Arab lands. “They have been working extremely hard on this,” said a European official who has monitored Iran’s role in both wars for the past five years. “This is a matter of pride for them on one hand and pragmatism on the other. They will be able to move people and supplies between the Mediterranean and Tehran whenever they want, and they will do so along safe routes that are secured by their people, or their proxies.”

Interviews during the past four months with regional officials, influential Iraqis and residents of northern Syria have established that the land corridor has slowly taken shape since 2014. It is a complex route that weaves across Arab Iraq, through the Kurdish north, into Kurdish north-eastern Syria and through the battlefields north of Aleppo, where Iran and its allies are prevailing on the ground. It has been assembled under the noses of friend and foe, the latter of which has begun to sound the alarm in recent weeks. Turkey has been especially opposed, fearful of what such a development means for Iran’s relationship with the PKK (the Kurdistan Workers’ party), the restive Kurds in its midst, on whom much of the plan hinges.

The plan has been coordinated by senior government and security officials in Tehran, Baghdad and Damascus, all of whom defer to the head of the spearhead of Iran’s foreign policy, the Quds force of the Revolutionary Guards, headed by Major General Qassem Suleimani, who has run Iran’s wars in Syria and Iraq. It involves demographic shifts, which have already taken place in central Iraq and are under way in northern Syria. And it relies heavily on the support of a range of allies, who are not necessarily aware of the entirety of the project but have a developed vested interest in securing separate legs.

Facebook Twitter Pinterest Maj Gen Qassem Suleimani, head of Iran’s all-powerful Quds force. Photograph: HO/AFP/Getty Images

The corridor starts at the entry points that Iran has used to send supplies and manpower into Iraq over the past 12 years. They are the same routes that were used by the Quds force to run a guerrilla war against US forces when they occupied the country – a campaign fought by the same Iraqi militias that have since been immersed in the fight against Isis.

The groups, Asa’ib ahl al-Haq, Keta’ib Hezbollah and their offshoots, accounted for close to 25% of all US battlefield casualties, senior US officials have said. They have become even more influential since US forces left the country. And in one of modern warfare’s starkest ironies, in the two years since US troops have returned to Iraq to fight Isis they have at times fought under US air cover.

The route crosses through Baquba, the capital of Diyala province, around 60 miles north of Baghdad. A mixed Sunni/Shia area for hundreds of years, Diyala became one of the main sectarian flashpoint areas during Iraq’s civil war. Along roads that have been secured by militias, which are known locally as “popular mobilisation units”, it then moves northwest into areas that were occupied by Isis as recently as several months ago.

The town of Shirqat in Salaheddin province is one important area. It was taken by militias along with Iraqi forces on 22 September, delivering another blow to the terrorist group and an important boost to Iran’s ambitions.

The Observer view on Russia’s actions in Syria and the failure of international law | Observer editorial Read more

The militias are now present in large numbers in Shirqat and readying to move towards the western edge of Mosul, to a point around 50 miles southeast of Sinjar, which – at this point – is the next leg in the corridor. Between the militia forces and Sinjar is the town of Tal Afar, an Isis stronghold, which has been a historical home of both Sunni and Shia Turkmen – ancestral kin of Turkey.

A senior intelligence official said the leg between Tel Afar and Sinjar is essential to the plan. Sinjar is an ancestral home to the Yazidi population, which was forced to flee in August 2014 after Isis invaded the city, killing all the men it could find and enslaving women. It was recaptured by Iraqi Kurdish forces last November. And ever since PKK forces from across the Syrian border have taken up residence in the city and across the giant monolith, Mt Sinjar, behind it. The PKK fighters are being paid by the Iraqi government and have been incorporated into the popular mobilisation units. Iraqi and western intelligence officials say the move was approved by Iraq’s national security adviser, Falah Fayadh.

An influential Iraqi tribal sheikh, Abdulrahim al-Shammari, emerges as a central figure further to the north. He has a power base near the Rabia crossing into Syria, receives support from the popular mobilisation units and is close to the Assad regime in Damascus. “I believe that in our area Iran does not have very much influence,” he told the Observer in Baghdad. “There is nobody here, no major power that is helping us with weapons. Ideologically speaking, the PKK is affiliated with the Kurds of this area, so there is no problem having them here.”

From the Rabia crossing, the mooted route goes past the towns of Qamishli and Kobani towards Irfin, which are all controlled by the Syrian Kurdish YPG militia. Throughout the war the YPG (People’s Protection Units) has hedged its bets, at times allying with the US against Isis, and at other times siding with the Syrian regime. “Iran thinks it has them where it wants them now,” said the European source. “I’m not sure it has gauged the Turks correctly, though.”

Facebook Twitter Pinterest A fighter sits on a balcony in Sinjar, Iraq after the town was retaken from Isis by Kurdish-led forces. Photograph: Cengiz Yar/The Guardian

Of all the points between Tehran and the Syrian coast, Aleppo has concentrated Iran’s energies more than anywhere else. Up to 6,000 militia members, mostly from Iraq, have congregated there ahead of a move to take the rebel-held east of the city, which could begin around the same time as the assault on Mosul.

Those who have observed Suleimani up close as he inspects the frontlines in Syria and Iraq, or in meetings in Damascus and Baghdad, where he projects his immense power through studied calm, say he has invested everything in Syria – and in ensuring that Iran emerges from a brutal, expensive war with its ambitions enhanced. “If we lose Syria, we lose Tehran,” Suleimani told the late Iraqi politician Ahmed Chalabi in 2014. Chalabi told the Observer at the time that Suleimani had added: “We will turn all this chaos into an opportunity.”

Securing Aleppo would be an important leg in the corridor, which would run past two villages to the north that have historically been in Shia hands. From there, a senior Syrian official, and Iraqi officials in Baghdad, said it would run towards the outskirts of Syria’s fourth city, Homs, then move north through the Alawite heartland of Syria, which a year of Russian airpower has again made safe for Assad. Iran’s hard-won road ends at the port of Latakia, which has remained firmly in regime hands throughout the war.

Ali Khedery, who advised all US ambassadors to Iraq and four commanders of Centcom in 2003-11 said securing a Mediterranean link would be seen as a strategic triumph in Iran. “It signifies the consolidation of Iran’s control over Iraq and the Levant, which in turn confirms their hegemonic regional ambitions,” he said. “That should trouble every western leader and our regional allies because this will further embolden Iran to continue expanding, likely into the Gulf countries next, a goal they have explicitly and repeatedly articulated. Why should we expect them to stop if they’ve been at the casino, doubling their money over and over again, for a decade?”