The unnamed guard told the Libya Herald the attempt began with a group of protesters who arrived at the prison in suburban Tripoli and started firing at guards as they forced their way through the main gate.
Inside the prison, a number of inmates started to break down doors in what appeared to be a coordinated effort, the guard said.
An alert was sounded and security forces rushed to the prison while authorities ordered all roads in the area closed.
Wounded prisoners and protesters were taken to the Tripoli Medical Center.
Earlier this month 18 prisoners from Ruwaimi managed to escape when a police vehicle taking them back to the prison was ambushed by gunmen.