Iraq oil police
A member from the oil police force stands guard at Zubair oilfield in BasraReuters

Having seized Iraq's second city and rampaged south towards the capital Baghdad, Sunni extremists have now attacked Iraq's largest oil refinery in the city of Baiji, 155 miles north of Baghdad.

Led by the brazenly brutal Islamic State of Iraq and the Levant (Isis), the militants lobbed mortar rounds and fired machine guns in an early morning raid. The battle raged well into the evening, with the outcome still undecided.

Refinery staff had clearly been expecting the attack. Insurgents had surrounded the facility for days and foreign staff were evacuated the evening before the raid.

The refinery is potentially an extremely valuable prize. It can process up to 300,000 barrels of crude per day, when operating at full capacity. Until recently, it was supplied by crude coming from the oilfields around Kirkuk, seized by Kurdish forces after national security forces fled.

The attack fits in with the calculated manner in which Isis goes about its business. The group has been active in eastern Syria, where it battles other rebel militias as well as Syrian regime loyalists.

While Isis became notorious for its viciousness in Syria (it was disowned by al-Qaeda for its extreme violence), the group is also notable for its financial savvy, especially when it comes to oil facilities.

Easily sold on the black market, where it is either smuggled over the border to Turkey or sold to the Syrian regime, oil in Syria has generated a vast revenue stream for the jihadi militants. It is a precious source of financing for the group.

Sources in Syria say the money has been used for myriad purposes; to purchase weapons, to pay fighters, to pay off local tribes and even to fund the state-building activities that Isis undertakes in its bid to win hearts and minds.

In rebel-held Syria, close to the oil producing hubs in Deir Ezzor province, entire oil markets have sprung up. Extraction is mostly improvised, but amounted to between 30,000 and 50,000 barrels per day in April, according to the Financial Times which cited an oil engineer at the Syrian Observatory for Human Rights. A Carnegie Endowment report suggested Syria's oil producing regions were generating up to $50m per month.

Isis craves oil as it provides them with something more valuable than simple cash – it frees them to act autonomously from demanding state backers. The group has been listed as a terrorist organisation in the United States and the United Kingdom, meaning that its bank activities will be subject to intense scrutiny.

Iraq's largest oil refinery is an extremely valuable asset for both Isis and the Iraqi government, which is why the battle for Baiji will not be a walkover.