Several explosions rocked key areas held by Kurdish forces in the oil rich Iraqi city of Kirkuk as the country tries to fight the Islamic State extremist group and allied Sunni militants. (Reuters)

Bombings in Baghdad and the northern city of Kirkuk killed at least 42 people in Iraq on Saturday as the government investigated a deadly attack on a Sunni mosque the day before that has heightened sectarian tensions amid a fragile political transition.

In oil-rich Kirkuk, long disputed by Baghdad and the Kurdish regional government, three bombs went off in a crowded commercial district, killing 31 people and wounding dozens, Kirkuk deputy police chief Tarhan Abdel-Rahman said.

One witness said he heard “an explosion between the cars, and then we started carrying out the dead bodies from there while people were burning inside the shops and cars.”

In Baghdad, a suicide bomber had earlier driven an explosives-laden car into the gate of the intelligence headquarters in Karrada district, killing six civilians and five security personnel, a police officer said. He said 24 other people were wounded.

A medical official confirmed casualty figures. Both officials spoke on the condition of anonymity as they were not authorized to brief the media.

The attacks came after parliament speaker Salim al-Jubouri said that a committee of security officials and lawmakers were probing Friday’s attack on a village mosque in Diyala province, northeast of the capital, which killed more than 60 people. The results of the investigation are expected in two days’ time.

It remained unclear whether the attack in the village of Imam Wais was carried out by Shiite militiamen or insurgents from the Islamic State group who have been advancing into mixed Sunni-Shiite areas in Diyala and have been known to kill fellow Sunni Muslims who refuse to submit to their harsh interpretation of Islamic law.

Since early this year, Iraq has faced an onslaught by the Islamic State extremist group and allied Sunni militants, who have seized large areas in the country’s west and north. The group took over Iraq’s second-largest city, Mosul, in June, and has since declared an Islamic state, or caliphate, in the territory under its control in Iraq and neighboring Syria.

The attack led two major Sunni parliamentary blocs to pull out of talks on forming a new government. The move creates a major hurdle for Shiite prime minister-designate Haider al-Abadi as he struggles to reach out to Sunnis to form a government by Sept. 10 that can confront the Islamic State extremists.

In a news conference, Jubouri did not say who might have been behind the attack, saying only that such violence was “carried out by the same hands who want to derail the process of building the government.”

Jubouri heads one of the blocs that suspended talks, but he declined to comment on the move at the news conference, saying he was there in his capacity as parliament speaker. Abadi issued a statement late Saturday calling upon all political blocs to submit their nominations for ministerial positions in the new government.

Also Saturday, an explosion in the Kurdish capital, Irbil, injured three people, according to military officials. It remains unclear what caused the explosion.