In early June​ , Abbas Saddam, a private soldier from a Shia district in Baghdad serving in the 11th Division of the Iraqi army, was transferred from Ramadi, the capital of Anbar province in western Iraq, to Mosul in the north. The fighting started not long after he got there. But on the morning of 10 June the commanding officer told his men to stop shooting, hand over their rifles to the insurgents, take off their uniforms and get out of the city. Before they could obey, their barracks were invaded by a crowd of civilians. ‘They threw stones at us,’ Abbas recalled, ‘and shouted: “We don’t want you in our city! You are Maliki’s sons! You are the sons of mutta! You are Safavids! You are the army of Iran!”’

The crowd’s attack on the soldiers shows that the fall of Mosul was the result of a popular uprising as well as a military assault by Isis. The Iraqi army was detested as a foreign occupying force of Shia soldiers, regarded in Mosul – an overwhelmingly Sunni city – as creatures of an Iranian puppet regime led by Nouri al-Maliki. Abbas says there were Isis fighters – always called Daash in Iraq after the Arabic acronym of their name – mixed in with the crowd. They said to the soldiers: ‘You guys are OK: just put up your rifles and go. If you don’t, we’ll kill you.’ Abbas saw women and children with military weapons; local people offered the soldiers dishdashes to replace their uniforms so that they could flee. He made his way back to his family in Baghdad, but he hasn’t told the army he’s here because he’s afraid of being put on trial for desertion, as happened to a friend. He feels this is deeply unjust: after all, he says, it was his officers who ordered him to give up his weapon and uniform. He asks why Generals Ali Ghaidan Majid, commander of ground forces, and Abboud Qanbar, deputy chief of staff, who fled Mosul for Kurdistan in civilian clothes at the same time, haven’t been ‘judged and executed as traitors’.

Shock at the disintegration of the army in Mosul and other Sunni-majority districts of northern Iraq is still determining the mood in Baghdad weeks later. The debacle marks the end of a distinct period in Iraqi history: the period between 2006 and 2014 when the Iraqi Shia under Maliki sought to dominate the country much as the Sunni had done under Saddam Hussein. The Shias’ feeling of disempowerment after the Mosul collapse has been so unexpected that they believe almost any other disaster is possible. In theory, the capital should be secure: it has a population of seven million, most of them Shia, and is defended by the remains of the regular army as well as tens of thousands of Shia militiamen. But then almost the same might have been said of Mosul and Tikrit, where the insurgents may have had popular support but were always outnumbered and outgunned. Before they collapsed – four or five divisions have still not been re-formed – the Iraqi security services counted 350,000 soldiers and 650,000 police. They were opposed by an estimated 6000 Isis fighters, though these were backed up by local tribes and former army officers. Even if Isis is seen only as the shock troops of a revolt by the six or seven million-strong Sunni community in Iraq, it was still an extraordinary military success on one side and an unprecedented failure on the other. ‘Enemies and supporters alike are flabbergasted,’ the Isis spokesman Abu Mohammed al-Adnani declared, while warning Isis fighters not to be over-impressed by all the American-made military equipment they had captured. ‘Do not fall prey to your vanities and egos,’ he told them, but ‘march towards Baghdad’ and give the Shia no time to catch their breath.

The government’s first reaction to defeat was disbelief and panic. Maliki blamed the fall of Mosul on a deep conspiracy, though he never identified the conspirators. He looked both baffled and defiant, but appeared to feel no personal responsibility for defeat despite having personally appointed all 15 of the army’s divisional commanders. A Baghdad newspaper reported that no fewer than seven ministers and 42 MPs had taken refuge in Jordan along with their families. Those politicians who have stayed are apprehensive: Dhia’a al-Assadi, one of the leaders of the movement of the populist cleric Muqtada al-Sadr, said: ‘We expect terrible days to come. They will be crucial in deciding whether Iraq stays united.’ In the first days after the fall of Mosul there was a sense of half-suppressed hysteria in the empty streets: people stayed at home, frightened, to follow the latest news on television. Many had stocked up on food and fuel within hours of hearing about the army’s collapse. Propane gas, with which Baghdadis normally cook, was in short supply: Isis had cut the road to Kirkuk, where the gas cylinders come from. Sweet shops and bakeries make special pasties for breaking the fast at the end of the day during Ramadan, but few people were buying them. Weddings were cancelled. Rumours swept the city that Isis was planning to make a sudden lunge into the centre of Baghdad and storm the Green Zone in spite of its immense fortifications.

The biggest fear was that Isis fighters, only an hour’s drive away in Tikrit and Fallujah, would time their attack to coincide with an uprising in the capital’s Sunni enclaves. The Sunni in Baghdad, though buoyed by the news of the fall of Sunni provinces to the insurgents, were afraid that the Shia would be tempted to carry out a pre-emptive massacre of the Sunni minority in the city as a potential fifth column. Sunni strongholds, like al-Adhamiya on the east bank of the Tigris, appeared to be deserted. I tried to hire a driver recommended by a friend. He told me he needed the money but he was a Sunni and the risk of being stopped at a checkpoint was too great. ‘I am so frightened,’ he said, ‘that I always stay at home after six in the evening.’ It was easy to see what he meant. Sinister-looking men in civilian clothes, who might be from government intelligence or from the Shia militias, had suddenly appeared at police and army checkpoints, picking out suspects: they were clearly in a position to give orders to the policemen and soldiers. Sunni office workers asked to go home early to avoid being arrested; others stopped going to work. Being detained at a checkpoint carries an extra charge of fear in Baghdad because everybody, particularly the Sunni, remembers what it led to during the sectarian civil war of 2006-7: many of the checkpoints were run by death squads and the wrong ID card meant inevitable execution. Press reports claimed the killers were ‘men dressed as policemen’ but everybody in Baghdad knows that policemen and militiamen are often interchangeable.

There is nothing paranoid or irrational about the ever present sense of threat. Iraq’s acting national security adviser, Safa Hussein, told me that ‘many people think’ Isis will ‘synchronise attacks from inside and outside Baghdad’. He believed such an assault was possible though he thought it would lead to defeat for Isis and the Sunni rebels who joined them. The Sunni are in a minority but it wouldn’t take much for an attacking force coming from the Sunni heartlands in Anbar province to link up with districts in the city such as Amariya, Khadra and Dora. Much depends on how far Isis is overextended, surprised by its own victories and lacking the resources to strike at the capital. In Baghdad, unlike Mosul, the Shia mass of the population would oppose them and the militiamen would fight to the death for their families. A fatwa by Grand Ayatollah Ali al-Sistani, the most influential leader for Iraqi Shia, called for a levee en masse of ‘able-bodied Iraqis’ to defend the country, and tens of thousands volunteered to join the army or establish their own militias. Even so, Isis could create mayhem in the capital without a direct assault by sending in its suicide bombers, closing the airport or taking over the Sunni towns just south of Baghdad – the area the Americans used to call the Triangle of Death – and partly encircling the capital.

A rational calculation of the balance of forces in any prospective battle for Baghdad shows that Isis has shot its bolt for the moment and can’t advance out of Sunni-dominated provinces. But Baghdadis are wary of assuming that they’re safe because they know they have to take into account the gross incompetence of the ruling elite around Maliki, which clings to power as if it had not just lost half the country. Even the generals who openly abandoned their troops in Mosul, Ali Ghaidan Majid and Abboud Qanbar, still hold their old jobs, two of the three most important in the army. ‘I still see them turning up to military meetings in Baghdad and they often sit in the front row as if nothing had happened,’ a senior official said despairingly. ‘It is beyond a joke.’

Also comical – and self-defeating – are the government’s attempts to prop up civilian morale in the face of humiliating defeat. Isis keeps putting out professionally made films showing its successes, as well as publicising its atrocities against Shia and government employees. The government’s response is to pretend that its defeats never happened and that only a sorry remnant of Isis fighters are still holding out. Somehow, it imagined it could conceal the extent of the disaster by closing down Twitter, YouTube and Google, as well as many local websites. It demanded that television stations close or focus on government successes, though these couldn’t be filmed since they were almost entirely imaginary. Fed up with these fictions, viewers deserted the main government channel, al-Iraqiya, and switched to others, including the Dubai-based, Saudi-backed channel al-Arabiya, which usually has live pictures to go with its reports. ‘Iraq is a visual culture where people don’t believe things unless they’ve seen pictures of it,’ says Ammar al-Shahbander, head of the Institute for War and Peace Reporting in Baghdad. The fact that a city or town has been lost is often revealed by an account of a counterattack, though that kind of crass propaganda is scarcely new. Kamran Karadaghi, formerly chief of staff to President Jalal Talabani, says he knew things must be going seriously wrong when he heard a news broadcast six months ago saying that ‘terrorists had been smashed east of Abu Ghraib.’ Since Abu Ghraib is on the western outskirts of Baghdad, this would mean that the ‘terrorists’ were already penetrating the capital. At the end of June a press facility was arranged by the Iraqi army to reassure the media that government forces still held Abu Ghraib, the gateway through which any Isis attack will probably come. Several miles short of Abu Ghraib, the officer in charge of the press party raised up an arm and pointed in its general direction, saying, ‘You see, all perfectly peaceable’; despite pleas from the accompanying journalists, he refused to advance another yard.

Since the days of Saddam, Iraqis have been adept at bypassing official censorship. Attempts after the fall of Mosul to cut them off from the internet worked for a few days, then different means of gaining access were found. ‘My mother was in her home village and she hardly knows how to use a laptop,’ a friend said. ‘But she told me that local boys had shown her how to install a program that would cut through government restrictions.’ The story is typical. Iraqis in the street are often better informed than ministers: thanks to extended families they have relatives or friends scattered across the country. After Isis attacked the Baiji refinery and the town next to it, on the Tigris north of Baghdad, I talked to a man called Abu Nahid, who confirmed that the town had fallen, though there was still fighting at the refinery. The Isis fighters weren’t bothering people on the whole, but they had knocked on his door to ask how many unmarried women there were in the house, explaining that some of their mujahedin wanted to get married. He told them that there were two women in his house, both married, but they insisted on coming in and confirming this by looking at the women’s ID cards. Abu Nahid has a sister living in Tikrit, south of Baiji, who said that a government counterattack had stalled at the entrance to the city. But she was taking her family out of Tikrit because there was no water or electricity and the government had begun random bombing. Back in Baghdad, the senior official told me that ‘Maliki wanted a military success on the day parliament opened on 1 July to boost his chances of holding onto power, which is why he told the army to attack Tikrit.’

In reality​ , Maliki stands no chance of serving a third term as prime minister, a post he has held since 2006. His political alliance did well in the parliamentary election on 30 April, when, ironically, he successfully positioned himself as the leader who knew about security and would defend the Shia against Sunni counterrevolution. Discredited by military defeat, he has few allies left in the outside world: even the Iranians, under whose influence he was supposed to be, no longer fully support him. During his eight years in power he created what one former minister calls ‘an institutionalised kleptocracy, more corrupt than anything in central Africa’, which will do everything to stay in power or, at least, avoid prosecution if it has to go. Though Baghdad looks tattered and impoverished, oil revenues run at $100 billion a year, and great fortunes can be made by anyone with the right connections to government. In the bird market in Baghdad, which sells all types of pets aside from birds, a shopkeeper offered to sell me a tiger cub last year and took out his phone to show me a picture of it gambolling on the ground at his farm outside the city. I asked him who had the money to buy such expensive pets and he became circumspect, saying his customers were tribal leaders and government people but giving no names.

There is a connection between the buoyant market for tiger cubs and the fall of Mosul. I asked a recently retired four-star general why he thought the army had fallen apart so quickly and why its commanders had fled. ‘Corruption! Corruption! Corruption!’ he replied: pervasive corruption had turned the army into a racket and an investment opportunity in which every officer had to pay for his post. He said the opportunity to make big money in the Iraqi army goes back to the US advisers who set it up ten years ago. The Americans insisted that food and other supplies should be outsourced to private businesses: this meant immense opportunities for graft. A battalion might have a nominal strength of six hundred men and its commanding officer would receive money from the budget to pay for their food, but in fact there were only two hundred men in the barracks so he could pocket the difference. In some cases there were ‘ghost battalions’ that didn’t exist at all but were being paid for just the same. Soldiers would kick back half their salaries to their officers in return for never going near a barracks. Checkpoints on roads acted like private customs posts, charging a fee to every truck passing through. A divisional commander might have to pay $2 million for his job: when one candidate asked where he could get that kind of money, he was told to borrow it and pay back $50,000 a month through various forms of extortion. Safa Hussein at the National Security Council confirmed that prices for military posts had soared in the last five years – a position that cost $20,000 in 2009 would now be worth ten times as much.

The corruption had devastating effects on every level of the Iraqi army. Defeat in Mosul was preceded by defeat in Anbar province in the first six months of the year, with the army suffering 5000 casualties and 12,000 desertions. Even the depleted units that did reach the front were often left without food for days. Men were sent to fight with only four clips of ammunition for their rifles. Fuel was in short supply and shortages of everything grew worse as Isis and its allies swept through the Sunni provinces. Corrupt private companies had no intention of delivering supplies over roads where they risked bombs and ambushes.

‘The army is still dissolving,’ Dhia’a al-Assadi said a month after the disaster at Mosul. ‘It is dysfunctional and so is the police force.’ A brief counteroffensive towards Tikrit to boost Maliki’s political fortunes had petered out. Sistani’s fatwa had produced many volunteers, and officers from Iran’s Revolutionary Guard are trying to build up a military force parallel to the army, drawing on their experiences in Syria. The government has asked the Americans for drone and air strikes on Isis’s convoys of trucks: the trucks are packed with fighters skilled at waging guerrilla war, suddenly attacking and withdrawing, since experienced fighters are never used to hold captured territory. Isis describes the strategy as ‘moving like a serpent through rocky ground’. Not that they are short of recruits: Safa Hussein told me studies showed that where Isis takes over an area it can recruit five or ten times the number of its original force, so if it starts out with a hundred men it will soon field five hundred or a thousand. These wouldn’t be experienced fighters, and some would simply want to protect their families, but with its large new recruiting grounds Isis is rapidly expanding its forces. A hope in Baghdad is that Isis is simply the fanatical edge of a more moderate Sunni revolt. This comforting argument holds that one day tribal and other leaders, having used their extremist allies to defeat the Baghdad government, will turn on them as they did in 2006-7. On the other hand, the world’s cemeteries are full of people who thought they could use extremists for their own ends and then dispose of them. Isis has taken measures against betrayal, insisting that other armed groups in Mosul lay down their arms and pledge allegiance to its new caliphate, the Islamic State. It isn’t going to implode.

Iraq now has a political crisis and a military crisis, neither of which is likely to be resolved soon. In Baghdad, a failed prime minister and his government cling to power. Sunni representatives who don’t dare visit their own cities and towns vie for posts in the capital. Kurds have an expanded and quasi-independent state. Isis has no plans other than to defeat its enemies on the battlefield. People in the capital wonder apprehensively when the battle for Baghdad will begin. When an American military delegation came to review the capital’s defences, a senior Iraqi official told them ‘to look to see which ministers had put fresh sandbags around their ministries. Those that have done so like myself will stay and fight; where you see old sandbags it means the minister doesn’t care because he is intending to run.’

4 July