Gunmen stormed a prison Tuesday in northern Iraq, freeing about 140 inmates but most were recaptured soon afterward, police said.

The attack began shortly before sunset at the Badoosh prison, 25 kilometers (15 miles) northwest of Mosul, police Brig. Gen. Mohammed al-Wakaa said. The gunmen freed prisoners cell by cell and fled, acccording to the Associated Press.

Police rushed to the area, which was illuminated by U.S. helicopters. By late Tuesday, all but 47 of the prisoners had been recaptured, police said.

Local security officials said the attackers were insurgents.

But the prison has a poor security record, according to Associated Press reports.

Last December, a nephew of Saddam Hussein who serving a life sentence for financing insurgents escaped from the same prison with the help of a police officer, authorities said. Ayman Sabaawi remains at large.