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 and the doubts that followed the 2003 U.S.-led invasion now haunt those trying to decide how to respond.
U.S. President Barack Obama will brief lawmakers later Wednesday at the White House on what options his wary country could take.
Iraqi Prime Minister Nouri al-Maliki, meanwhile, struck an optimistic tone after soldiers abandoned their posts in the wake of the initial offensive, promising his nation would teach the attackers a "lesson."
"We have now started our counteroffensive, regaining the initiative and striking back," al-Maliki said.
Al-Maliki's relatively upbeat assessment came as the military claimed its forces regained parts of the strategic city of Tal Afar near the Syrian border, which Islamic State fighters captured Monday. Its closeness to the Syrian border strengthens the Islamic State's plan to carve out an "Islamic emirate" stretching across the Iraq-Syria border.
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 on Wednesday morning. There was no independent confirmation of his claims, nor those on the Iraqi military retaking neighborhoods in Tal Afar. The areas are in territories held by insurgents that journalists haven't 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.
In New Delhi, the Foreign Ministry said that 40 Indian construction workers have been kidnapped in Iraq. Meanwhile, the Turkish Foreign Ministry said its diplomats were investigating claims that militants abducted 60 foreign construction workers, including some 15 Turks, near the oil city of Kirkuk in northern Iraq.
Indian Foreign Ministry spokesman Syed Akbaruddin said the government has been unable to contact the workers.
There are about 10,000 Indian citizens working and living in Iraq. Akbaruddin said only about 100 are in violent, insecure areas. That includes the construction workers near Mosul, Iraq's second-largest city, as well as 46 Indian nurses working in a hospital in the Iraqi town of Tikrit. Both Mosul and Tikrit were captured by the Islamic State last week.
Near Kirkuk, which Kurdish fighters took over from fleeing Iraqi soldiers amid the militants' advance, the Islamic State kidnapped 60 foreign construction workers building a hospital, Turkey's private Dogan news agency reported Wednesday. The agency based its report on an unnamed worker who was reportedly freed by the militants.
The Turkish Foreign Ministry could not immediately confirm the report but said its embassy was investigating.
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. The three cities are home to some of the most revered Shiite shrines. The Islamic State also has tried to capture Samarra north of Baghdad, home to another major Shiite shrine.
Iran, a neighboring Shiite powerhouse, 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.
Iraq's once-dominant Sunni minority has long complained of discrimination by al-Maliki's government and excesses by his Shiite-led security forces. Al-Maliki has consistently rejected charges of bias against the Sunnis and has in recent days been stressing the notion that the threat poses by the Islamic State will affect all Iraqis regardless of their ethnic or religious affiliations.
Al-Maliki also appeared Tuesday night on television with Sunni leaders and politicians as a sign of solidarity.
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 for combating the Islamic militants, including airstrikes or a contingent of special forces.
The White House has continued to emphasize that any military engagement remains contingent on the government in Baghdad enacting political reforms and ending sectarian tensions, which have killed thousands since late last year.
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."
During the United States' eight-year presence in Iraq, American forces acted as a buffer between the two Islamic sects, albeit with limited success. But U.S. forces fully withdrew at the end of 2011 when Washington and Baghdad could not reach an agreement to extend the American military presence there.
Iraq has the world's fifth-largest known crude oil reserves, with an estimated 143 billion barrels, according to the U.S. Energy Information Administration. It produced some 2.58 million barrels of oil day in May, according to the Oil Ministry.
The price of oil neared $107 on Wednesday after easing slightly Tuesday.
Associated Press writers Katy Daigle in New Delhi and Suzan Fraser in Ankara, Turkey, contributed to this report.