Police counter-attacked, backed by fighters from the Brigades of the 1920 Revolution, a Sunni Arab armed group previously allied with al-Qaeda in Iraq.
Dilayan said that in one of the houses attacked, Sheikh Yunis al-Tae and an unknown number of his sons were killed, and 17 people were wounded.
He said the attackers shelled the town with mortars before storming it. They also used rocket-propelled grenades and reduced some houses to rubble.
A police officer and 21 locals were among the dead, as were 10 alleged al-Qaeda in Iraq fighters, the chief of police said. The death toll is likely to rise as emergency workers dig through the rubble.
|Iraqi troops hunted for suspected al-Qaeda|
members in villages around Baquba [AFP]
Dilayan said the attackers took 15 people - eight women and seven children - as hostages before retreating.
Police said they arrested 22 of the attackers.
The fighting is an example of the violent power struggle between anti-government fighters and Sunni Arab groups now aligned with US forces and the Shia-led government.
US troops have been cracking down on armed groups who are using the region as launch pad for attacks in Baghdad.
In other violence, a roadside bomb killed an American soldier and wounded four more west of the Iraqi capital, the US military said on Thursday.
The latest death, which occurred on Wednesday, brought the military's losses in Iraq since the invasion in March 2003 to 3,721, according to an AFP count based on Pentagon figures.
Another 14 US troops were killed when their helicopter crashed in the northern province of Kirkuk on Wednesday, one of the worst such accidents in the four-and-a-half-year old conflict in Iraq.