Mosul has been a dangerous place since the US-led invasion of 2003. It is the greatest Sunni Arab city of Iraq during an era in which the Sunni had lost their old predominance and have struggled against Shia-dominated governments in Baghdad and Kurdish rulers next door in Iraqi Kurdistan.

It is a battle that is still going on as the Iraqi army and Shia paramilitaries advance on Mosul from the south while Kurdish Peshmrga come from the east. The way is cleared for both by air strikes, predominantly by the US air force, attacking Isis fighters dug into ruined villages and hiding in deep tunnels.

If the anti-Isis forces ultimately succeed in recapturing Mosul it will be the fifth time the city has changed hands in the course of 13 years of war. The first time was in April 2003 when the Iraqi army was breaking up and surrendering and the Kurdish Peshmerga burst into the city. There was looting on a mass scale which the Arabs blamed on the Kurds and vice versa, but in fact both took part. I saw crowds ransack the governor’s mansion, the Central Bank and the university.

The Arabs, three-quarters of the city’s population of two million, were appalled by the Kurdish incursion. I visited the biggest hospital in Mosul where the director Dr Ayad Ramadani told me that “the Kurdish militias are looting the city. Today the main protection is from civilians organised by the mosques.” By the entrance to the hospital, a family was loading the body of a deceased relative into the back of a truck when there was a burst of machine gun fire. This frightened the truck driver who sped away leaving the body behind and the family angrily waving their fists after him.

Relations between Arabs and Kurds did not get much better over the following years. The Kurdistan Regional Government (KRG) claimed parts of Nineveh province around Mosul which it said had a Kurdish majority or had historically belonged to the Kurds. Mosul sits at the heart of a fascinating but confusing ethnic and sectarian mosaic made up of Arabs, Kurds, Shabak, Yazidis and Christians of different dominations. Few of these communities had any liking for the others.

The Kurdish takeover was followed by the Americans and for the rest of 2003 General David Patraeus commanded the 101st Airborne Division in the city. He could see how the “de-Baathification” campaign mandated by the US authorities in Baghdad was alienating former Iraqi army officers and officials who were now out of a job. A high proportion of the army officer corps had always come from Mosul and, in keeping with this military tradition, the defence minister under Saddam Hussein was from the city. Petraeus issued de-Baathification certificates on his own authority so these unemployed officers were at least eligible for a job.

Inside Isis secret tunnels Show all 7 1 /7 Inside Isis secret tunnels Inside Isis secret tunnels Network of underground tunnels was discovered by Kurdish forces after they regained the town of Sinjar in Iraq Inside Isis secret tunnels A member of the Peshmerga forces inspects a tunnel used by Isis militants in the town of Sinjar, Iraq Reuters Inside Isis secret tunnels An entrance to the tunnel used by Islamic State militants is seen in the town of Sinjar, Iraq Inside Isis secret tunnels The secret tunnels allowed militants to freely move underground Inside Isis secret tunnels The tunnels appear to be wired with electricity Inside Isis secret tunnels Some of the tunnels are 30 feet deep Inside Isis secret tunnels Concerns remain that parts of the tunnels are rigged with explosives

It was not enough. The Americans over-confidently thinned out their troops and then withdrew the remainder to take part in the recapture of Fallujah. In November 2004, Iraqi armed opposition fighters raced into the city, the newly reformed Iraqi army fled and the rebels captured aresnals of weapons. They withdrew after a few days and Baghdad, backed by the US, regained a shaky control.

But Baghdad’s rule was always contested between 2004 and 2014. There were repeated guerrilla attacks. I would travel from Irbil in KRG to visit the Kurdish deputy governor whose well-fortified office was on the far side of the Tigris river. But we either had to drive very fast or go more slowly in convoys defended by troops and armoured vehicles.

Isis releases video claiming everything is fine in Mosul

Al-Qaeda in Iraq never entirely lost its grip on Mosul even when it was at its lowest ebb before 2011. Local businesses had to pay it protection money, close down or risk assassination. A Turkish businessman with several big construction contracts there recalled later that he had to pay $500,000 (£400,000) a month and, when this was increased and he refused to pay up, one of his employees was killed. He stopped work, withdrew his staff to Turkey and complained to the government in Baghdad. But their only proposal was that he pay the protection money and add the sum to his contract price.

The government was much disliked in Mosul, but even so the Isis capture of the city in June 2014 was an astonishing victory of a few thousand fighters against a garrison that was meant to total 60,000 and may have had as many as 20,000 soldiers and police. The difference between the two figures was made up of “ghost soldiers” who did not exist or never came to the barracks but whose salaries were taken by officers. Many other soldiers had simply gone on leave to Baghdad and never come back as the security situation deteriorated. When Isis attacked the army and police dissolved.

Isis was never popular in Mosul but they ferociously suppressed all dissent. They drove out the Christians and murdered and enslaved the Yazidis. They blew up iconic monuments like Jonah’s Tomb. People may have disliked them, but there was not much they could do about it.