MORE than 1000 inmates, mostly common law offenders, have escaped during a prison riot and attack in the restive Libyan city of Benghazi, a security official has told AFP.

"There was a riot inside Al-Kuifiya prison, as well as an attack from outside. More then 1000 prisoners escaped. Special forces called in as reinforcements were given orders not to fire at the prisoners," he said on Saturday, asking not to be named.

The official said most of the escapees were common law detainees, including nationals of other African states.

"But some of them were detainees in cases linked to the former regime of Muammar Gaddafi," he said.

Several were recaptured shortly after the breakout.

Prime Minister Ali Zeidan confirmed the incident, without giving the number of fugitives.

"Residents of the area carried out the attack because they don't want the prison near their homes," he said, adding that border posts had been alerted and given a list of names to apprehend the escapees.

Zeidan earlier announced that border posts with Egypt had been closed to prevent the escape of the killers of a prominent activist in the eastern Libyan city on Friday.