WHISKY is back on the tables in Mosul, one of Iraq’s biggest cities. Until last year, boozing was punishable with 80 lashes. These days a refurbished hotel with a nightclub on the roof, set in a wood that had sheltered the high command of the so-called Islamic State (IS), is fully booked. Shops around the ruins of Mosul’s university have new fronts. Families queue at restaurants on the banks of the Tigris. There is not a niqab, or face-veil, in sight.

The revival of Mosul is a metaphor for Iraq as a whole. When IS captured the city in 2014, Iraq seemed a lost cause. Its armed forces had fled. The government controlled less than half the country and the jihadists stood primed to march into Baghdad. With the collapse of oil prices in 2015, the government was broke. Iraq was a byword for civil war, sectarianism and the implosion of the Arab state order established at the end of the first world war.

Now Iraq, home to nearly 40m people, is righting itself. Its forces have routed the would-be caliphate and regained control of the borders. A wave of victories has turned Iraq’s army into what a UN official calls the Middle East’s “winniest”. Baghdad feels safer than many other Middle Eastern capitals. The government is flush with money as the oil price has doubled since its low in 2016 and production has reached record levels. No wonder 2,000 foreign investors packed hotel ballrooms earlier this year at an Iraq-reconstruction conference in Kuwait.

Remarkably, given its belligerent past and the region’s many conflicts, Iraq enjoys cordial relations with all its neighbours. America and Iran may be bitter rivals, but both give Iraq military and political backing. Gulf states, overcoming decades-long sectarian and security fears, have restored diplomatic relations and want to invest. To cap it all, Iraq remains a rarity—the only Arab state, other than Tunisia, to get rid of its dictator and remain a democracy. Its fourth multiparty election since 2003 will take place on May 12th. In a region of despots, Iraqis talk freely. Media and civic groups are vibrant.

Counting the cost

Some think the war was needed to bring Iraqis to their senses. If so, it was a terrible form of therapy. In the 15 years since America’s invasion of Iraq, some 300,000 Iraqis and 4,400 American soldiers have been killed (see chart). Of the many rounds of strife, none matched the viciousness of the fight against IS. At least 7,000 civilians, 20,000 security personnel and over 23,000 IS fighters were killed, according to a think-tank in Baghdad. Priceless heritage, like Mosul’s old city, was reduced to rubble. About 6m people, most of them Sunnis, lost their homes. In quick succession, three ideologies tearing the country apart have been tamed. Revanchism by the Sunni Arab minority, who are about 15-20% of the population but have dominated Iraq since Ottoman times, was a cocktail of Saddam Hussein’s brutal Baathist nationalism and even more brutal jihadism. It spawned al-Qaeda in Iraq and IS. But today it seems weaker than ever. “Sunnis finally felt what it meant to be Kurdish or Shia,” says an influential government adviser. “They know they are no longer top dogs.” Triumphalism by the long-repressed Shia Arab majority, making up about 60% of the population, also turned violently sectarian. But this seems to have lost much of its appeal after 14 years of misrule by Shia religious parties. The Shia south may have most of Iraq’s oil, but it looks as wrecked and neglected as the Sunni north. And Kurdish nationalism lies in tatters, too. Denied independence in the 1920s, the Kurds are scattered across four countries. In Iraq they have long enjoyed quasi-independence in an enclave in the north-east. But last September Masoud Barzani, the Kurdish president, overreached by calling a referendum for a fully fledged state, defying Baghdad as well as protests from America and Iran. When he refused to back down, Iraqi forces snatched back the disputed territories that Kurds held beyond their official autonomous region (about 40% of their realm); the Iraqi government also imposed an embargo on foreign flights (now lifted). Kurdish leaders are negotiating a way out of their isolation. But many Kurds seem none too upset, given how autocratic and dirty Mr Barzani’s regime is. “It would have been a Barzanistan, not a Kurdistan,” says a teacher.

Iraq has not looked so united since 1991, when Kurds and Shias rose up against Saddam after his occupying forces were pushed out of Kuwait by an American-led coalition. Many Shia volunteers died delivering Sunnis from the barbarous rule of IS. About 45,000 Sunnis mustered alongside the Shia-led Hashd al-Shaabi, or “popular mobilisation units”. And millions of Sunnis fled the would-be caliphate to seek refuge in Kurdish and Shia cities.

Revenge killings by Shia militias have been rarer than many had feared. “We expected much worse,” says a local councillor in Falluja, a Sunni city recaptured in 2016. The Hashd still display their religious insignia at checkpoints on the highways (softened with plastic flowers), but in Sunni cities the policing is largely local. Hashd barracks are low-key and often mixed. “Half of them are Sunni,” says a Hashd commander in Tikrit, Saddam’s home town, pointing at the dozen men in his mess. A Kurdish politician who supported the referendum expresses relief. “No one threatened me or my job,” says Dara Rashid, a deputy housing minister.

As security improves, barriers within the country are coming down. Many of the checkpoints snarling traffic in central Baghdad have gone. The curfew was lifted in 2015. The Suqur checkpoint separating Baghdad from Anbar province, notorious for delays and maltreatment, still shuts at sundown. But Anbar’s Sunnis no longer need a sponsor to enter Baghdad. For the first time since 2003, your correspondent drove the length of Iraq, from the border with Kuwait to the one with Turkey, without a security escort or special permits.

The calm is drawing Iraqis home. Worldwide it takes five years on average for half of those displaced by conflict to return home after a war, says the UN. In Iraq it has taken three months. “We’ve seen nothing like it in the history of modern warfare,” says Lise Grande, who headed UN operations during the war on IS. Millions returned without compensation, electricity or water. Rather than wait for the government to provide homes, they are repairing the wreckage themselves.

Lecturers at Tikrit University have raised funds from private evening classes, rebuilt their war-battered campus and redesigned the curriculum “to promote peaceful coexistence”, says the dean of Sharia Studies, Anwar Faris Abd. In this staunchly Sunni city, trainee clerics now study Shia as well as Sunni schools of law. In the spirit of reconciliation, half of the university’s 30,000 students are Shia.

Religious minorities feel safer, too. Over 70% of the 100,000 Christians who fled to Kurdistan have returned to their homes on the Nineveh plains, says Romeo Hakari, a Christian parliamentarian in Erbil. Sunnis from Mosul joined Chaldean Catholics to celebrate mass at their church in Bakhdida, whose icons IS used for target practice.

There has been a striking backlash against organised Islam. Mosque attendance is down. Although Sunnis are rebuilding their homes in Falluja, the minarets and domes in the city once known as “the mother of mosques” lie abandoned and ruined. “Only old men go to pray,” explains a 22-year-old worker mixing cement. Designer haircuts and tracksuit tops are the latest male fashion, because IS banned them. “Our imams radicalised us with IS and terror but refuse to admit it,” says a Sunni final-year student at Tikrit University with a bouffant hairdo.

Mistrust of clerics is as keenly felt in the Shia south. The turbaned Iranians gracing Basra’s billboards invite scorn. Cinemas banned since 1991 are reopening. Iraq’s first commercial film in a generation went on release this month. “The Journey” tells of a female suicide-bomber who, just as she is about to blow herself up, questions how she will rip apart the lives of people around her. It pours compassion on perpetrator and victim alike.

Secularism is making inroads even in the holy city of Najaf, the seat of Iraq’s ayatollahs, which has thrived on Shia pilgrimage since the American invasion. The new public library at the golden-domed shrine of Imam Ali includes sizeable collections of Marx’s tracts and non-Muslim scriptures. Shia clerics who until recently banned Christmas trees and smashed shop windows displaying love-hearts on Valentine’s Day now let them pass.

Iraq’s dominant religious parties used to flaunt their sectarian loyalties to get out the vote at elections. Now many hide them. An opinion poll last August showed that only 5% of Iraqis would vote for a politician with a sectarian or religious agenda. Yesteryear’s Shia supremacists these days promise to cherish the country’s diversity, and recruit other sects to their ranks.

All this produces strange bedfellows. Muqtada al-Sadr, a Shia cleric with a base in the shantytowns of Baghdad and Basra, has allied with communists, whom he once damned as heretics. Iraq’s branch of the Muslim Brotherhood, an Islamist party, has joined forces with al-Wataniya, an anti-sectarian party led by a former Baathist, Iyad Allawi. As old alignments break apart, the Iraqi National Alliance, which grouped the main Shia parties, has split into its constituent parts. Kurdish and Sunni blocs are fragmenting too. Several religious factions have assumed secular names. “At least five masquerade behind the word ‘civil’,” complains the leader of the Civil Democratic Alliance, a genuinely secular party.

Against this background one worry stands out. Iraq’s politicians are mostly failing to rise to Iraq’s new spirit. If not on the international conference circuit, the government can be found in the Green Zone, the city within a city that the Americans carved out of Baghdad with six-metre-high concrete blast walls. The fortress provides a safe space for foreigners and officials to do business, say its residents. But for many Iraqis it is where officials conspire to siphon off public money.

The main government jobs are still dished out by sect and ethnicity. In healthy democracies the opposition holds the executive to account. In Iraq the government is a big tent. Factions name their own ministers, and they in turn appoint ghost workers to claim salaries. Ports, checkpoints and even refugee camps are seen as sources of cash and divvied out between factions. Appointment is rarely on merit. The head of Najaf’s airport is a cleric. Opinion polls suggest that most Iraqis want new faces, but Iraq’s leaders remain mostly the ones America installed in 2003.

Reasons for disillusion include the slow pace of reconstruction and the lack of jobs. Many Iraqis praise the speed with which the UN helped the displaced get home; they think their own politicians were remiss. Three million children are still out of school. A quarter of Iraqis are poor.

Iraq’s economy has fluctuated as wildly as its geopolitical fortunes. GDP per person collapsed after the war for Kuwait in 1991 and during the American-led invasion of 2003. A gradual recovery was interrupted by the upheaval of 2014 and 2015 (see chart). Economic activity may now be set to take off again. Oil output has risen from a low of 1.3m barrels a day (b/d) in 2003 to 4.4m. Iraq is already OPEC’s second-biggest producer, with output predicted to rise to 7m b/d by 2022. It has amassed over $50bn in reserves, about a quarter of GDP.

There are small signs of government investment: fancy lampposts in Falluja and Mosul, astro-turf pitches in Hilla and a grass verge with fountains along Baghdad’s airport road. But some of the Middle East’s largest factories still lie idle—everything from steel and paper mills to factories that made syringes, textiles and more. Since most sanctions were lifted in 2003 a country that used to make things has come to rely far more on oil. It uses its oil money to finance patronage in the bloated public sector and imports almost everything, including petrol, from its neighbours. Officials pocket commissions and bribes in the process.

As a result, foreign governments are wary of giving aid. “It’s a bottomless pit,” despairs a Gulf minister. The country has an anti-corruption watchdog, the Commission of Integrity, but that too is said to have succumbed to factional profiteering.

Suspicion of foreigners, a relic of the Saddam era, risks lowering the appetite of potential investors. Iraq’s Safwan border crossing lies an hour’s drive away from the Kuwait conference where Haider al-Abadi, the prime minister, declared Iraq open for business. It could not be less inviting. Rubble left over from American bombing 15 years ago spills over the pavements. Four sets of officials had to sign and stamp entry papers before your correspondent could bring in his laptop. “We still think foreigners are spies or imperialists bent on plunder,” grumbles an Iraqi fund manager.

Disgruntlement carries great dangers. It is common to hear Iraqis long for a military strongman like Egypt’s general-cum-president, Abdel-Fattah al-Sisi, or a Chinese-style autocrat, to rid Iraq of democracy’s curse. Many even express nostalgia for Saddam, most notably in the south, where his yoke fell heaviest. They recall how, despite UN sanctions, he repaired bombed bridges and power plants within a year of the war of 1991. He somehow kept the hospitals and electricity running, criminals off the streets and the country self-sufficient in rice, sugar and vegetable oil. “Before 2003 the state still cared about art, theatre and the preservation of antiquities,” says a sculptor who works above Basra’s old canal, which now flows black with sewage.

For all the war fatigue, the threat of renewed violence is never far away. Mr Barzani’s humiliated Peshmerga fighters threaten to hit back if their marginalisation continues. “Just as they destabilised Kurdistan, we can destabilise Iraq,” says one of his advisers. He threatens to send fighters to pillage Iran, which he holds ultimately responsible for the Iraqi army’s strike against the Kurds. The Hashd, for their part, are armed and expect to be treated like heroes, not sent home empty-handed.

Abadi in motion

On a map of northern Iraq, a UN official draws five large red boxes, covering most of its main cities. Each, she warns, indicates where IS could resurface. “Many IS fighters shaved their beards, put on dirty sandals and walked out,” says an international observer. In February a squad hiding in the Hamrin mountains north of Tikrit ambushed and killed 27 soldiers. There have been frequent strikes since. The refugee camps are thought to be full of sleeper cells, padlocked behind wire fencing. The rain floods their tents, watering grievances. Just as Egypt’s prisons nurtured Ayman al-Zawahiri, al-Qaeda’s leader, and America’s Camp Bucca in Iraq bred Abu Bakr al-Baghdadi, the IS leader, Iraq’s prisons may now be “incubating a new generation of trauma and terror”, says Nada Ibrahim, a Sunni doctor in Baghdad.

Break the curse

Iraq has known, and wasted, other hopeful moments. The overthrow of Saddam was botched by America, which shut Sunnis out of the new order. The respite won by its surge of troops in 2007-08 was botched by Nuri al-Maliki, the then prime minister from Dawa, a Shia Islamist party, who ran a sectarian government. Can Mr Abadi break the cycle?

Iraq holds much promise, given its abundant oil and water and its educated population. And Mr Abadi is remarkably popular among Sunnis even though he, like Mr Maliki, is from Dawa. “We want elections and we want Abadi to win,” cheers a female lawyer in Mosul’s courthouse, surrounded by nodding colleagues.

Yet Mr Abadi has failed to turn his military victory into political gain. Some of his own advisers compare him to Churchill, who led Britain to victory over Nazi Germany only to be voted out of office. Iraq’s leaders seem unlikely to act as Britain’s did, turning from war to social reform; instead they are risking a reversion to civil strife. Confronted with a dispirited population, powerful militias, lurking jihadists and scheming politicians, Iraq’s governing class has yet to show it knows how to win the peace.