Iraqis have a well-honed instinct about approaching danger which stems from their grim experience during 40 years of crisis and war. Three months ago, I asked a friend in Baghdad how she and her friends viewed the future, adding Iraq seemed to me to be more peaceful than at any time since the US and British invaded in 2003.

She replied that the general mood among people she knew was gloomy because they believed that the next war between the US and Iran might be fought out in Iraq. She said: “Many of my friends are so nervous about a US-Iran war that they are using their severance pay on leaving government service to buy houses in Turkey.” She was thinking of doing the same thing.

My Iraqi friends turned out to have been all too right in their depressing prognosis: the killing of Iranian General Qassem Soleimani by a US drone at Baghdad airport is an act of escalation by President Donald Trump that ensures that Iraq faces a violent future. It may not lead to a full-scale military conflict, but Iraq will be the political and military arena where the US-Iranian rivalry will be fought out. The Iranians and their Iraqi allies may or may not carry out some immediate retaliatory act against the US, but their most important counter-stroke will be to pressure the Iraqi government, parliament and security forces into pushing the US entirely out of Iraq.

Ever since the overthrow of Saddam Hussein, Iran has generally come out ahead of the US in any struggle for influence within Iraq. The main reason for this is has been that Shia community in Iraq, two-thirds of the population and politically dominant, has looked to its fellow Shia in Iran for support against its enemies. Ironically, Iranian influence and popularity had been seriously damaged because of General Soleimani overseeing the brutal efforts by pro-Iranian security forces and paramilitary groups to crush Iraqi street protests, killing at least 400 protesters and injuring another 15,000.

Mounting Iraqi popular rage against Iran for its interference in Iraq’s internal affairs is now likely to be counter-balanced by the even more blatant assault on Iraq’s national sovereignty by the US. It is difficult to think of a grosser act of interference by a foreign state than killing a foreign general who was openly and legally in Iraq. Also killed by the drone was Abu Mahdi al-Muhandis, the leader of Kata’ib Hezbollah, the powerful pro-Iranian paramilitary group. The US may consider paramilitary commanders like him to be evil terrorists, but for many Shia Iraqis they are the people who fought against Saddam Hussein and defended them against Isis.

I was speaking to my pessimistic friend in Baghdad in late September in what turned out to be the last peaceable days before violence returned to Iraq. I interviewed a number of paramilitary commanders from the Hashd al-Shaabi, the popular mobilisation forces, who all claimed that the US and Israel were escalating attacks on them inside the country. I wondered how much of this was paranoia.

I spoke to Abu Alaa al-Walai, the leader of Kata’ib Sayyid al Shuhada, a splinter group of Kata’ib Hezbollah, one of whose camps had been destroyed by a drone attack in August. He said that 50 tonnes of weapons and ammunition had been blown up, blaming the Israelis and the Americans acting in concert. Asked if his men would attack US forces in Iraq in the event of a US-Iran war, he said: “Absolutely yes.” Later I visited the camp, called al-Saqr, on the outskirts of Baghdad where a massive explosion had gutted sheds and littered the burned-out compound with shattered pieces of equipment.

I saw other pro-Iranian paramilitary leaders at this time. The drone attacks had made them edgy, but I got the impression that they did not really expect a US-Iran war. Qais al-Khazali, the head of Asaib Ahl al-Haq, told me that he did not think there would be a war “because Trump does not want one.” As evidence of this, he pointed to the failure of Trump to retaliate after the drone attack on Saudi oil facilities earlier in September that Washington had been blamed on Iran.

In fact, events developed very differently from what both I and the paramilitary commanders expected. A few days after I had spoken to them, there was a small demonstration in central Baghdad demanding jobs, public services and an end to corruption. The security forces and the pro-Iranian paramilitaries opened fire, killing and wounding many peaceful demonstrators. Though Qais al-Khazali later claimed that he and other Hashd leaders were trying to thwart a US-Israeli conspiracy, he had said nothing to me about it. It seemed likely that General Soleimani, wrongly suspected that the paltry demonstrations were a real threat and had ordered the pro-Iranian paramilitaries to open fire and put a plan for suppressing the demonstrations into operation.

All this could have been disastrous for Iranian influence in Iraq. Soleimani had made the classic mistake of a successful general in imaging that “a whiff of grapeshot” will swiftly repress any signs of popular discontent. Sometimes this works, often it does not – and Iraq turned out to belong to the second category.

General Soleimani died in the wake of his greatest failure and misjudgement. But the manner of his killing may convince many Shia Iraqis that the threat to Iraqi independence from the US is greater than that from Iran. The next few days will tell if the protest movement, that has endured the violence used against it with much bravery, will be deflated by the killings at Baghdad airport.

ORDER IT NOW

Wars are reputedly won by generals who make the least mistakes. General Soleimani made a bad mistake over the last three months by turning a modest protest into something close to a mass uprising. Trump may have made an even worse mistake by killing General Soleimani and making Iraq, a place where Iran has far more going for it than the US, the arena in which the rivalry between these two powers will be fought out. I can see now that my friend in Baghdad may well have been right three months ago in suggesting that retirement to Turkey might be the safest option.