Fighters from the Islamic State of Iraq and the Levant (ISIL) group have set large parts of Iraq's largest oil refinery on fire, in an effort to thwart advances by Iraqi security forces.

Black plumes of smoke could be seen coming from parts of the sprawling complex on Monday as the Iraqi army backed by Shia militias advanced to within 2km of the facility, which lies about 200km from the capital Baghdad.

Colonel Maan al-Saeedi, the commander of the second federal police brigade, told Al Jazeera: "ISIL have rigged [Beiji] with booby trapped trenches, sand barracks and roadside bombs."

"We are hoping that our forces will overcome these obstacles, the enemy is desperate and lost manpower and firepower and therefore is trying different methods to halt our advance."

Beiji is Iraq's largest oil refinery and produces a third of the country's oil output. The government would lose a large slice of revenue if the installation was destroyed.

ISIL captured Beiji city in June during a lightning advance through northern Iraq and since then, they have surrounded the oil refinery and halted its production.

Despite months of air strikes by the US and its allies in a bid to stop the group's advance, ISIL has continued to seize towns and cities in Iraq and neighbouring Syria.

The US administration has criticised Iraqi forces for showing no will to fight against ISIL during the fall of Ramadi.

The US pulled its troops out of Iraq in December 2011 after it failed to gain immunity for a planned residual force of several thousand soldiers.

The US spent an estimated $8bn on training the Iraqi army between 2003 and 2012, according to the US army magazine, the Army Times.

According to the International Displacement Monitoring Centre, at least 2.2 million people fled their homes in 2014 after ISIL seized parts of northern Iraq.