Authorities said all 33 prisoners in the cells were freed and 10 attackers were killed in the battle before dawn on Tuesday.
In the capital, a group of US senators met Ibrahim al-Jaafari, the interim prime minister, to discuss prospects for formation of a national unity government, a step viewed as all important in working towards peace and a withdrawal of US troops from Iraq.
Al-Jaafari said he thought that Iraq's most difficult political hurdles had been crossed and predicted that a new government would be ready in weeks.
"I hope that the formation of the new government does not last beyond April," al-Jaafari said.
Carl Levin, on the Senate Armed Services Committee, said: "April is fine, but it is necessary that this commitment be kept in order for there to be continued support for the presence of American troops in Iraq."
The committee chairman, John Warner, said decisions on the US troop presence would be made not only by George Bush, congress and other leaders, but by "the American people" - an apparent allusion to falling support for the Iraq war among Americans.
As many as 100 men armed with automatic rifles and rocket-propelled grenades stormed the judicial compound in Muqdadiyah, about 90km northeast of the capital.
The assault began after the attackers fired a mortar round into the police and court complex, said police Brigadier Ali al-Jabouri.
Tuesday's attack in Muqdadiyah
was a major security setback
After burning the police station, the attackers detonated roadside bombs as they fled, taking the bodies of many of their dead comrades with them, police said.
At least 13 police officers and civilians and 15 assailants were wounded in the attack.
Later on Tuesday, a roadside bomb killed one police officer and wounded three in Baquba, 60km northeast of Baghdad, authorities said.
Five other police were wounded in two separate roadside bomb attacks on patrols in northern and southern Baghdad early Tuesday, police said.
Tuesday's assaults came a day after 39 people were reported killed by insurgents and shadowy sectarian gangs in Iraq, continuing the wave of violence that has left more than 1000 Iraqis dead since the bombing last month of a Shia Muslim shrine.
US convoys in Baghdad continue
to be a target of attacks
Police found the bodies of at least 15 more people - including that of a 13-year-old girl - dumped in and near Baghdad. The discoveries marked the latest in a string of execution-style killings that have become an almost daily occurrence as Sunni and Shia extremists settle scores.
During Monday night, a bomb struck a coffee shop in northern Baghdad, killing at least three civilians and injuring 23 others.
The bomb was left in a plastic bag inside the shop in a market area of the Azamiyah neighbourhood, Falah al-Mohammadewi, a police major, said.
About the same time, armed men killed two oil engineers leaving work at the Baiji refinery north of Baghdad. An electrical engineer and technician were gunned down at the nearby power station, Khalaf Ayed Al-Janabi, the Baiji police lieutenant said.
A coffee shop bombing left three
dead in Baghdad on Monday
Separately, the owner of a small grocery in central Baghdad was shot and killed.
In southeast Baghdad, also towards evening, a roadside bomb blew apart a minibus, killing four pilgrims returning from Karbala, where millions of Shia gathered to mark the 40th and final day of the annual mourning period for Imam Hussein, grandson of the Prophet Muhammad.
Five pilgrims on their way to Karbala were wounded in a drive-by shooting earlier in the day, police said.
Otherwise, the commemoration passed largely without incident.
The international airport in Baghdad remained closed on Tuesday after authorities cited the need to protect the Karbala commemoration.