In an attack that local officials said they had been warned about, insurgents briefly took control of a government building in Iraq’s north-central Diyala province Tuesday in a multi-stage raid that has added to doubts about the readiness of the country’s security forces.

The assault on the provincial council headquarters in Baqubah, about 35 miles northeast of Baghdad, included a car bombing and attacks carried out by men armed with assault weapons and suicide bombers who detonated explosives-laden belts inside the building, security officials said.

The insurgents overpowered Iraqi police and attempted to take hostages, leading to a fierce firefight that killed at least nine people. It took more than an hour for Iraqi police and army units, backed by U.S. military helicopters and soldiers, to bring the situation under control.

Local officials said U.S. intelligence officials had told them several weeks ago of an imminent threat to the heavily guarded facility.

“Who bears the responsibility for what happened today? Definitely, it’s the security forces and the fruitless devices to detect explosives,” said Tala al-Jubouri, the province’s deputy governor for planning and implementation. “We had two weeks’ warning.”

The attack followed several days of violence across Iraq, including the deaths of two U.S. soldiers Monday in the south. U.S. military officials announced the deaths Tuesday but provided no other details, pending notification of the soldiers’ next of kin.

With the remaining 46,000 U.S. troops in Iraq scheduled to depart by Dec. 31, Iraqi and American military officials say they have made substantial progress in combating terrorist and insurgent groups.

But terrorist organizations continue to prove that they can penetrate the country’s defenses, renewing questions about how Iraqi security forces will perform without continued training and support from the U.S. military.

On Monday, insurgents also killed at least four people at an Iraqi police command center in the southern port city of Basra, which has been relatively safe in recent years. Two days earlier, at least 10 people were killed when a car bomb exploded at a marketplace in Mosul, in northern Iraq.

In a televised address to cabinet ministers, Prime Minister Nouri al-Maliki appeared to play down concerns about the nation’s security forces.

“We have enough — and well-enough trained — security forces to prevent security breaches similar to those we saw in the past,” said Maliki, who must decide within weeks whether to ask President Obama to keep some U.S. forces in the country past the end of the year.

On Tuesday, U.S. military units helped Iraqi security forces respond to the well-coordinated insurgent assault in Baqubah.

Hafedh al-Jubouri, the deputy governor for administrative affairs in Diyala province, said Iraqi police forces were overrun when a car bomb exploded near the main gate of the provincial council building. Insurgents armed with assault rifles and rocket-propelled grenades then attacked from outside while two others blew themselves up inside the building, Jubouri said.

U.S. military officials said a U.S. army unit on routine patrol nearby conducted an “initial search of the building” and formed an “outer cordon” until “sufficient Iraqi security forces” arrived. U.S. Army helicopters also provided air support but did not fire on any targets on the ground.

In a statement issued Tuesday evening, the Interior Ministry blamed the attack on al-Qaeda in Iraq, saying the group wants to “prove its presence in the arena, despite the blows inflicted against it.”

Majeed is a special correspondent. Special correspondent Hassan al-Shammari contributed to this report.