WHEN Islamic State burst out of Syria in June 2014, seizing Mosul, Iraq’s second city, and nearly reaching Baghdad, it became the richest terror organisation in history. It plundered the banks in Mosul, including the Central Bank, whose vaults contained an estimated $425m. It snaffled a pipeline network filled with 3m barrels of oil. Its self-declared caliphate included some of the best agricultural land in the Fertile Crescent, and the heavy industry that Saddam Hussein had concentrated in loyal Sunni Arab areas. A report compiled for Reuters in October 2014 lists 13 Iraqi oilfields, three refineries, five cement plants, some big wheat silos and a salt mine. In Syria IS found a captive market for the oil from the 160 fields it had seized. Syria’s government is a customer. So, too, are other rebel groups and even some aid agencies operating in the north, says Rim Turkmani of the London School of Economics, whose report says American taxpayers are inadvertently helping to fund IS. “They control the bulk of Syria’s oil,” says Ludovico Carlino, author of a new report for IHS, a consultancy, “so whether you’re a militia, a civilian or a regime, you have to buy from IS’s middlemen.”

To manage its business portfolio, IS established a bureaucracy, complete with a rule book, the Principles of Administration. Straightforward extortion has evolved into a tax system with reference numbers, fixed rates and regulations for entertainment, including table football (provided the footballers’ heads are removed, as human images are forbidden). Oilfields and mines were nationalised (or rather, Islamised). Some businessmen welcomed the ability to pay a single fee for access to a caliphate spanning Iraq and Syria, rather than the many fees that multiple militias squabbling for control charge elsewhere in the area. An income tax of 30% is less than the 50% that Shia militias impose in neighbouring Salaheddin province. Some 200,000 Sunni Arabs who initially fled IS rule to the ungoverned spaces south-west of Kirkuk later returned home.

Earlier this year, monitors estimated the caliphate’s GDP at $6 billion. That is a huge sum for a terrorist group, but peanuts for a state of 7m at war. IS’s army consumes over 70% of revenues, according to the IHS report. Foreign fighters are particularly costly, with foreign Arabs being paid at least twice as much as locals and European fighters getting over three times as much. The Mosul windfall was quickly spent, forcing IS to mount fresh raids in search of loot. Waving IS flags and spouting jihadist ideology, Sunnis have chased their Christian neighbours from the prime farmlands of the Nineveh plains—a prize they had long coveted. IS’s destruction of antiquities has bolstered demand for those that remain. Its push towards Aleppo’s industrial zone has yielded a fresh crop of scrap metal.

But more recently, with coalition air attacks having checked IS’s advance and oil prices having plummeted, its finances have faltered. Its retreat from Kobani in January 2015 cost it not only access to a key Turkish border crossing, but the big Lafarge cement plant there. This October it lost Baiji, Iraq’s largest oil refinery. American air support for anti-IS rebels now threatens to cut off IS’s last direct access to the Turkish border, hampering its ability to attract new foreign fighters. In early 2015 Abu Saad al-Ansar, an IS leader in Mosul, announced a budget of $2 billion for the year. Monitors now expect it to get half that.

Feeling the strain, IS’s taxes and fines have climbed and grown more arbitrary. Where once governors across its 12 provinces fixed tax rates, now local municipalities do. Scores of imprisoned suspected collaborators have paid upwards of $30,000 to avoid having their heads cut off. Tensions fuelled by pay differentials have degenerated into skirmishes between local and foreign fighters in Tal Afar. Young men no longer attend Friday prayers for fear of being conscripted.

The bombing surge since October has prompted some to ask whether IS will survive. Of its 160 Syrian oilfields, 20 have come under attack. Al-Omar, Syria’s second largest, has faced four attacks in a fortnight from American, British and Russian planes. Total oil production has reportedly fallen from 100,000 barrels a day to below 40,000. Iraqis from Tal Afar say tanker traffic between Mosul and Raqqa has fallen sharply following repeated attacks. After strikes on big refineries, refining has become a cottage industry. Fuel prices have soared, as IS salaries and morale have fallen. Fearful of an exodus, IS has raised the cost of an exit permit to $1,800, and demands two named guarantors, who risk being murdered should its holder not return. So far, though, hopes for a collapse remain just that.