Iraqi government forces have reached within a kilometre of the country's biggest oil refinery, according to two army officers and a witness.

It is the closest they have come to breaking an Islamic State of Iraq and the Levant (ISIL) siege of the Beiji facility during months of fighting, the Reuters news agency reported.

Fighting raged on Friday in a village between the complex and the nearby town of Beiji, near a deserted area believed to contain roadside bombs planted by ISIL fighters that has been preventing an advance, the army officers said.

"Daesh [ISIL] militants are escaping to the direction of a river. Airplanes are targeting them," an army captain said.

However, the fragility of the security situation in the country was underscored by four bombings in and around the capital, which killed more than 30 people and wounded dozens more, according to medical and security sources.

The deadliest attack was a car bombing in a busy market area in northern Baghdad's Gorayaat area. Fifteen people were killed in the blast. Another explosion struck near a restaurant in the Adhamiyah district, killing 10, the sources said.

Battle for Beiji

Baghdad is hit by near-daily bombings and shootings that kill hundreds of people each month. Many of them are believed to be orchestrated by ISIL although the group has not been able to advance far beyond its stronghold in the western Anbar province.

Al Jazeera's Imran Khan, reporting from Baghdad on Friday, said the tactics used by the Iraqi army to re-take Beiji were significant.

"You have to remember that the Beiji oil refinery is partly in the control of ISIL and partly by Iraq's army, and that is why the battle for Beiji was so crucial. Now this battle took 20 days and it may well be a blueprint for battles here in the future due to the type of tactics that were being used," Khan said.

"The coalition really helped in the taking of the town, and also this idea that different types of Iraqi army units could work together."

Live Box 2014108135930757185

A witness said security forces had crossed a bridge close to the refinery, 200km north of the capital.

ISIL fighters seized the town of Beiji and surrounded the refinery in June during a swift campaign through northern Iraq.

The group also controls territory in neighbouring Syria and has proclaimed a "caliphate" straddling both countries.

Iraq's army initially put up little resistance to ISIL, but it has been helped in recent weeks by the US-led air attacks on ISIL positions.

Haider al-Abbadi, Iraqi prime minister, dismissed 26 military commanders recently for corruption and incompetence in the aftermath of ISIL advance.

In September, he retired two senior generals as part of an overhaul of the country's armed forces.

Speaking through an aide after Friday prayers, Grand Ayatollah Ali-al Sistani, Iraq's most senior Shia religious leader, reiterated his criticism of corruption in the military.

He also called on the government to get its finances in order, fund projects and create jobs.

Source: Al Jazeera and agencies