Militants pressing a major offensive in Iraq attacked the country's biggest oil refinery Wednesday, as the premier scrambled to regain the initiative by sacking security commanders and reaching out to political rivals.
The United States, which is mulling air strikes against the insurgents, said it believed Baghdad's security forces were rallying against the assault, while Iran pledged not to let Shia shrines in Iraq fall to the Sunni Arab militants leading the charge.
Washington has nevertheless deployed some 275 military personnel to protect its embassy in Baghdad, the first time it has publicly bolstered the mission's security, while other countries have also sought to evacuate nationals and pull diplomats out.
The crisis, which has displaced hundreds of thousands of Iraqis, threatens to carve up the country while the assault on the Baiji oil refinery early Wednesday will likely further spook international oil markets.
From about 4:00 am (0100 GMT), clashes erupted at the Baiji refinery complex in Salaheddin province, north of Baghdad, according to a senior official and a refinery employee.
They said some tanks containing refined products caught fire and that the Iraqi security forces had suffered casualties.
Prime Minister Nuri al-Maliki's security spokesman, Lieutenant General Qassem Atta, later said that Iraqi forces had repelled the attack in fighting which left 40 militants dead. He did not mention security force casualties.
The refinery was shut down and most employees evacuated on Tuesday due to a drop in demand caused by the militant drive, which is being spearheaded by jihadists from the Islamic State of Iraq and the Levant (ISIL).
World oil producers have cautiously watched the unfolding chaos in Iraq, which currently exports around 2.5 million barrels of oil per day, but have stressed that the country's vast crude supplies are safe -- for now.
Rebecca O'Keeffe, head of investment at stockbroker Interactive Investor said the attack on the Baiji refinery ought to have limited international impact.
"As I understand it, the Baiji refinery doesn't provide any supply outside of Iraq, so the impact of this attack is possibly less severe than feared," O'Keefe told AFP.
"However if the ISIL forces continue to make progress towards Baghdad and onto Iraq's main oilfields in the south, the current oil price stabilisation is likely to be short lived and we could see a significant spike in oil prices."
Further north, Iraqi security forces pushed into new areas of Tal Afar town on Wednesday during heavy fighting with militants, a provincial councillor said.
The Shia-majority town is located in Iraq's Nineveh province along a strategic corridor to Syria, and security forces have been battling militants for control of it for days.
But militants gained ground elsewhere, with a senior police officer saying they had moved into the Shia Turkmen area of Bashir in the northern province of Kirkuk early on Wednesday.
In a bid to see off the militant offensive, Maliki sacked several top security commanders on Tuesday evening, and then stood alongside several of his main rivals in a rare display of unity among the country's fractious political leaders.
Among those fired was the commander for the northern province of Nineveh, the first region to fall in the onslaught, which began on June 9.
Maliki also ordered that one officer face court martial for desertion.
The dismissals came after soldiers and police fled en masse as insurgents on Tuesday last week swept into Nineveh's capital Mosul, a city of two million.
Some abandoned their vehicles and uniforms when faced with the insurgents, which are led by ISIL fighters but also include loyalists of executed dictator Saddam Hussein.
After taking Mosul, militants captured a major chunk of mainly Sunni Arab territory stretching towards the outskirts of the capital.
Also on Tuesday evening, Maliki appeared on television alongside other senior Sunni and Shia political leaders, including the premier's fierce rival, parliament speaker Osama al-Nujaifi.
The group issued a joint statement pledging continuous dialogue and promising to preserve the country's unity.
And despite the early poor performance of the security forces, Pentagon spokesman Rear Admiral John Kirby said Iraqi troops, with help from Shia volunteers, were "stiffening their resistance" around Baghdad.
"It certainly appears as if they have the will to defend the capital," he said.
Washington has already deployed an aircraft carrier to the Gulf, but President Barack Obama has insisted a return to combat in Iraq for US soldiers is not on the cards.
Secretary of State John Kerry has, however, said that drone strikes could be used.
Iranian President Hassan Rouhani, meanwhile, said Wednesday that the Islamic Republic "will do everything" to protect Shia shrines in Iraqi cities against the militant assault.
The swift advance of militants has sparked international alarm, with UN envoy to Baghdad Nickolay Mladenov warning that the crisis was "life-threatening".
"Iraq faces the biggest threat to its sovereignty and territorial integrity" in years, he told AFP.
Jihadists are said to have killed scores of Iraqi soldiers as they pushed their advance, including in a "horrifying" massacre in Salaheddin province that has drawn international condemnation.
Short link: