In a televised address to the nation, Prime Minister Nouri al-Maliki struck an optimistic tone and vowed to teach the attackers a "lesson" — even though Iraqi soldiers abandoned their posts in the wake of the initial militant offensive.
"We have now started our counteroffensive, regaining the initiative and striking back," al-Maliki said.
The campaign by the al-Qaida-inspired Islamic State of Iraq and the Levant has raised the specter of the sectarian warfare that nearly tore the country apart in 2006 and 2007. The relentless violence that followed the 2003 U.S.-led invasion now haunts those trying to decide how to respond.
At the White House, President Barack Obama was to brief lawmakers later Wednesday on what options the U.S. could pursue.
The U.S. is pressing al-Maliki to undermine the insurgency by making overtures to Iraq's once-dominant Sunni minority, which has long complained of discrimination by al-Maliki's government and excesses by his Shiite-led security forces.
Al-Maliki, a Shiite, has consistently rejected charges of bias against the Sunnis and has in recent days been stressing the notion that the threat posed by the Islamic State will affect all Iraqis regardless of their ethnic or religious affiliations. He appeared Tuesday night on television with Sunni leaders and politicians as a sign of solidarity.
The prime minister's relatively upbeat assessment came as the Iraqi military said its forces regained parts of the strategic city of Tal Afar near the Syrian border, which Islamic State fighters captured on Monday. Its closeness to the Syrian border strengthens the Islamic State's plan to carve out an Islamic caliphate, or state, stretching across parts of the two countries.
It also came hours after the chief military spokesman, Lt. Gen. Qassim al-Moussawi, said government forces repelled an attack by militants on the country's largest oil refinery at Beiji, some 250 kilometers (155 miles) north of the capital, Baghdad.
Al-Moussawi said 40 attackers were killed in fighting there overnight and early Wednesday. There was no independent confirmation either of his claims or those of the Iraqi military's retaking neighborhoods in Tal Afar. The areas are in territories held by insurgents that journalists have not been able to access.
The Beiji refinery accounts for a little more than a quarter of the country's entire refining capacity — all of which goes toward domestic consumption for things like gasoline, cooking oil and fuel for power stations. Any lengthy outage at Beiji risks long lines at the gas pump and electricity shortages, adding to the chaos already facing Iraq.
Meanwhile, the Indian government said 40 Indian construction workers have been seized near Iraq's second-largest city, Mosul, which ISIL and allied Sunni fighters captured last week. Roughly 10,000 Indian citizens work and live in Iraq, with only about 100 in violent, insecure areas like Mosul, according to Foreign Ministry spokesman Syed Akbaruddin.
And the Turkish Foreign Ministry said its diplomats were investigating a Turkish media report that militants grabbed 60 foreign construction workers, including some 15 Turks, near the northern Iraqi oil city of Kirkuk.
Ethnic Kurds now control Kirkuk, moving to fill a vacuum after the flight of Iraqi soldiers. They too are battling the Sunni extremist militants.
On Wednesday, Kurdish security and hospital officials said that fighting has been raging since morning between Kurdish fighters known as peshmerga and militants who are trying to take the town of Jalula, in the restive Diyala province some 80 miles northeast of Baghdad.
Two civilians were killed and six peshmerga fighters were wounded, according to the officials, who spoke on condition of anonymity because they were not authorized to speak to the media.
Also in the Kirkuk area, Sunni militants attacked a cluster of villages Tuesday night, killing at least 20 ethnic Turkomen Shiites and burning 13 Shiite homes, said Shalal Abdoul, the mayor of the nearby town of Tuz Khormato. Two more Tukromen Shiites remain missing. Following the fighting, residents of the three villages left for Tuz Khormato, which is held by the peshmerga.
Meanwhile, Doctors Without Borders said shelling in the city of Tikrit on Friday caused severe damage to one of its clinics, disrupting medical care for tens of thousands of people displaced by the violence.
The Sunni militants of the Islamic State have vowed to march to Baghdad and the Shiite holy cities of Karbala and Najaf in the worst threat to Iraq's stability since U.S. troops left in late 2011. The three cities are home to some of the most revered Shiite shrines. The Islamic State also has tried to capture Samarra, a city north of Baghdad and home to another major Shiite shrine.
Iran, a neighboring Shiite country, already has seen thousands volunteer to defend the shrines. Iranian President Hassan Rouhani, speaking Wednesday to a crowd gathered at a stadium near his country's border with Iraq, said that the Islamic State and others would be defeated.
"We declare to all superpowers, their mercenaries, murderers and terrorists that the great Iranian nation will not miss any effort in protecting these sacred sites," Rouhani said.
The U.S. and Iran are discussing how the longtime foes might cooperate to ease the threat from the al-Qaida-linked militants. Still, the White House ruled out the possibility that Washington and Tehran might coordinate military operations in Iraq.
Some 275 armed American forces are being positioned in and around Iraq to help secure U.S. assets as Obama also considers an array of options.
Obama is not expected to approve immediate airstrikes in Iraq, in part because there are few clear targets that could blunt a fast-moving insurgency, U.S. officials said Tuesday.
Officials said Obama had made no final decisions and didn't rule out the possibility that airstrikes ultimately could be used, particularly if a strong target becomes available. But officials said the strikes were not the current focus of the administration's ongoing discussions about how to respond to the crumbling security situation.
Gen. Martin Dempsey, the chairman of the Joint Chiefs of Staff, said Wednesday that the U.S. does have a request from the Iraqi government for the Obama administration to use air power to stop the militants.
Republicans have been critical of Obama's handling of Iraq, but Congress remains deeply divided over what steps the U.S. can take militarily. Even lawmakers who voted in 2002 to give President George W. Bush the authority to use military force to oust Saddam Hussein have expressed doubts about the effectiveness of drone airstrikes and worry about Americans returning to the fight in a country split by sectarian violence.
"Where will it lead and will that be the beginning or the end?" Sen. Richard Shelby, R-Ala., said, when asked about possible U.S. airstrikes. "We don't know that. This underlying conflict has been going on 1,500 years between the Shias and the Sunnis and their allies. And I think whatever we do, it's not going to go away."
Associated Press writers Katy Daigle in New Delhi, Julie Pace and Bradley Klapper in Washington, and Suzan Fraser in Ankara, Turkey, contributed to this report.
Copyright 2014 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.