"A group of about 20 armed men burst into the establishment around 6am (0300 GMT)," said Captain Salam Abd al-Qadir, in charge of security at the hospital, 250km north of Baghdad, on Wednesday.
"They freed the detainee after opening fire on the policemen guarding his room. Three of them were killed and six wounded," the captain added.
The prisoner belonged to a cell linked to al-Qaida that had planned this week to murder Raed Juhi, one of the judges trying Iraq's deposed president in Baghdad, said police in Kirkuk, who dismantled the cell on Saturday.
Doctor Nihad Mohammed at the main Kirkuk hospital said the detainee had been wounded by gunfire when he was arrested with 11 other members of the cell.
He had been in a room on the second floor of the hospital and guarded by the policemen who were killed on Wednesday's attack by automatic gunfire from the assailants, the doctor added.
Police said on Saturday that all the members of the cell were Sunni Arabs from Kirkuk, Saddam's hometown of Tikrit and the flashpoint province of al-Anbar, west of the capital.
They confessed under interrogation, police said, to planning to kill Juhi.
Saddam and seven of his former deputies are on trial about the massacre of 148 Shia villagers in the early 1980s. The fifth hearing of the trial is scheduled to begin later on Wednesday.