The Ain Zara prison in Libya

Some 400 people have reportedly escaped from a prison in a suburb of the Libyan capital Tripoli. The area has been engulfed in heavy infighting between rival militias for days.

A state of emergency has been imposed in the Libyan capital Tripoli, following the massive jailbreak.

The inmates poured out of the prison's gate, with guards fearing for their own safety as the four-hundred-strong crowd stormed the entrance. "The detainees were able to force open the doors and leave," police said in a statement on Sunday.

The jailbreak was facilitated by the turmoil that has gripped the Libyan capital for a week now. A number of armed militia groups, some of them believed to be linked to the government in Tripoli, have been vying for control over the capital.

Police did not elaborate on what kind of offences the escaped inmates had committed.

Tripoli has been contested ground since the NATO-led invasion in 2011 left the country in ruins, with crumbled political and economic systems. Libya is often described as "a failed state" ever since the disastrous NATO-led invasion in 2011.  But the violence intensified last week, with the 7th Brigade militia from the city of Tarhuna, some 65 km from Tripoli, attacking a coalition comprised of the Tripoli Revolutionaries' Brigades (TRB), the Nawasi Brigade, the Chanewa Brigade, the Bab Tajoura Brigade and also Misrata's 301 Brigade, which later retreated.