BAGHDAD — Gunmen attacked a Sunni mosque during Friday prayers, killing at least 64 people and prompting Sunni lawmakers to freeze talks on forming a new government — a move that presents a major challenge to efforts to create an administration that can confront extremists who have seized large sections of the country.
It was not immediately clear if the attack was carried out by Shi’ite militiamen or extremists of the Islamic State group.
The Islamic State fighters have been advancing into mixed Sunni-Shi’ite areas in volatile Diyala province and have been known to kill fellow Sunni Muslims who refuse to submit to their harsh interpretation of Islamic law.
However, Sunni lawmakers quickly blamed the carnage on powerful Shi’ite militias out to avenge an earlier bombing, and two major Sunni parliamentary blocs pulled out of talks on forming a new Cabinet.
The move creates a major hurdle for prime minister-designate Haider al-Abadi as he struggles to reach out to disaffected Sunnis to form a government that can confront the Islamic State extremists.
Both Abadi and outgoing Prime Minister Nouri al-Maliki condemned the attack and called for an investigation.
Also Friday, US Central Command said it conducted three new airstrikes around the Mosul Dam, where clashes with militants continue nearly a week after Iraqi and Kurdish forces retook the sprawling facility with US air support.
The onslaught on the Musab bin Omair Mosque in the village of Imam Wais began with a suicide bombing near its entrance, followed by a raid by gunmen who stormed the building, opening fire on worshippers, security officials said.
Iraqi security forces and Shi’ite militiamen raced to the scene to reinforce security but stumbled on bombs planted by the militants, which allowed the gunmen to flee, according to officials in Imam Wais, 75 miles northeast of Baghdad.
At least 64 people were killed, including four Shi’ite militiamen, and more than 60 people were wounded, according to medical officials. All officials spoke on condition of anonymity because they were not authorized to brief the media.
In pointing the finger at Islamic State fighters, village officials said the Sunni extremists have been pressuring two prominent Sunni tribes in the area — the Oal-Waisi and al-Jabour — to join them, but so far they have refused.
However, local Sunni lawmakers in Diyala province blamed Shi’ite militiamen for what they said was a revenge attack for a bombing earlier Friday.
In that attack, a roadside bomb hit the convoy of a local Shi’ite militia leader, wounding three of his bodyguards, Sunni lawmaker Raad al-Dahlaki said. He said the militia leader survived, and out for revenge, entered the mosque along with fellow Shi’ite gunmen and opened fire.
Shi’ite militias then surrounded the general hospital in Baqouba, Diyala’s provincial capital, vowing to attack relatives of the dead, Dahlaki said.
In announcing their pullout from talks on forming a new government, Sunni parliamentary blocs affiliated with Parliament Speaker Salim al-Jabouri and Deputy Prime Minister Saleh Al-Mutlak demanded that the main Shi’ite parliamentary bloc hand over the perpetrators within 48 hours.
They also demanded that the Shi’ite bloc compensate the families of victims ‘‘if they want the political process and the new government to see the light of day.’’
The Obama administration condemned Friday’s ‘‘vicious attack,’’ and said it underscores ‘‘the urgent need for Iraqi leaders from across the political spectrum to take the necessary steps that will help unify the country against all violent extremist groups,’’ State Department deputy spokeswoman Marie Harf said.
If the mosque attack proves to have been carried out by Shi’ite militiamen it would deal a major blow to Abadi’s efforts to reach out to the country’s Sunni minority, whose grievances are seen as fueling the Islamic State insurgency.