Government forces said they had repelled an attempt by Sunni insurgents to seize Baquba, capital of Diyala province north of Baghdad, in heavy fighting. The dead included scores of prisoners from the local jail.
ISIL fighters launched their revolt by seizing the north's main city Mosul last week and have swept through the Tigris river valley north of Baghdad. They have boasted of massacring hundreds of troops captured in their advance.The fighters have been joined by other Sunni factions, including former members of ousted dictator Saddam Hussein's Baath Party and tribal figures, who share widespread anger among Iraq's Sunni minority at perceived oppression by the Shi'ite-led government of Prime Minister Nuri al-Maliki.
Western countries, including the US, have urged Mr Maliki to reach out to Sunnis to rebuild national unity as the only way of preventing the disintegration of Iraq.
But the long-serving prime minister, who won an election two months ago, seems to be veering in the opposite direction - relying more heavily than ever on his own majority sect and vowing to purge opposition politicians and military officers he has labelled "traitors".
Hassan Suneid, a close Maliki ally, said the governing Shi'ite National Alliance should boycott all work with the largest Sunni political bloc, Mutahidoon.
The sudden advance by Sunni insurgents is scrambling alliances in the Middle East, with the US and Iran both saying they could cooperate against a common enemy, all but unprecedented since the 1979 Iranian revolution.
Iraqi officials confirmed the Baiji refinery north of Baghdad had shut down and foreign workers evacuated, although they said government troops still held the vast compound. With the refinery shut, Iraq will have a harder time generating electricity and pumping water to sustain its cities in summer.
The refinery has been protected by elite troops, while the nearby town largely fell to ISIL fighters last week. Baiji's refinery had stayed open despite years of civil war while US forces were in the country, and the threat to it shows how much more vulnerable Iraq is now to insurgents than it was before Washington pulled out troops in 2011.
Tens of thousands of Shi'ites have rallied at volunteer centres in recent days, answering a call by the top Shi'ite cleric to defend the nation. Many recruits have gone off to train at Iraqi military bases.
But with the million-strong regular army abandoning ground despite being armed and trained by the US at a cost of billions, the government is increasingly relying on extra-legal Shi'ite militia to fight on its behalf, re-establishing groups that fought during the 2006-2007 bloodletting.
According to one Shi'ite Islamist working in the government, well-trained fighters from the Shi'ite organisations Asaib Ahl Haq, Khetaeb Hezbollah and the Badr Organisation are being deployed as the main combat force, while new civilian volunteers will be used to hold ground after it is taken.
Battle lines are now formalising, with the insurgents held at bay about an hour's drive north of Baghdad and just on the capital's outskirts to the west.