Heavily armed gunmen stormed Libya's parliament this evening  in an assault claimed by forces loyal to a renegade ex-general who has vowed to purge the country of Islamist militants.

In a confusing, chaotic attack, heavy smoke rose from the parliament building in Tripoli as gunmen clashed with guards. A Reuters reporter said the attackers raided and left, and other unknown gunmen later closed off nearby streets.

Another witness said attackers had kidnapped two people and heavy gunfire could be heard across other parts of Tripoli, where rival brigades of former rebels have often clashed since ending their 2011 war against Muammar Gaddafi.

Details of who carried out the parliament attack were unclear, but a spokesman for retired Libyan general Khalifa Haftar said his forces had carried out the assault as part of his campaign to rid Libya of Islamist militants.

"These are members of the Libyan National Army," Mohamed al-Hejazi, spokesman for the group said, using the name of the irregular forces loyal to Haftar.

Haftar, a former rebel in the war against Gaddafi, had already sent his fighters into Benghazi on Friday against Islamist militants based there, claiming Libya's government had failed to halt violence in the eastern city.

At least 40 people were killed in those clashes, which involved some air force helicopters.

On Saturday, parliamentary speaker and military commander-in-chief Nuri Abu Sahmain accused Haftar of trying to stage a coup. Several reports said Sahmain had been kidnapped after Sunday's attack, but he denied that.

ARMED BRIGADES

After the 2011 NATO-backed war, Libya's weak government and nascent army struggled to impose any authority over heavily armed brigades and militias who once fought Gaddafi and have become powerbrokers often challenging the state.

Libya's parliament has been paralysed by divisions between Islamist parties and more nationalist rivals, leaving many Libyans frustrated at the lack of progress toward democratic transition since the fall of Gaddafi.

Militia brigades in armoured trucks mounted with anti-aircraft canons have often stormed parliament, occupied ministries and even kidnapped the prime minister last year in a show of military muscle to make political demands.

But Sunday's attack on parliament was the most serious violence in the capital for months, and appeared to expand Haftar's campaign against hardline Islamists, who emerged as a force in North Africa since the Arab Spring revolts of 2011.

Lawmaker Omar Bushah told Reuters that gunmen had stormed into the General National Congress building, raiding lawmakers' offices and set the building on fire.

There were no immediate reports of any casualties from hospital officials.

COUP RUMOURS

Haftar stirred rumours of a coup in February by appearing in a Libyan military uniform to call for a presidential committee to be formed to govern until new elections as a way to end the country's political impasse.

It was unclear how much support Haftar has in the regular armed forces or among the network of competing militias who have carved out fiefdoms in parts of the country.

But in Benghazi, the cradle of the uprising against Gaddafi, authorities have struggled to curb violence and stem attacks blamed on Ansar al-Sharia, an Islamist group that Washington labels as a terrorist organisation.

Since the end of Gaddafi's one-man rule, Libya's fragile democracy has hobbled from crisis to crisis with the country on its third prime minister since March, its new constitution unwritten and parliament deadlocked by infighting.

Just hours before the attack, new Prime Minister Ahmed Maiteeq announced he had formed a government pending parliamentary approval this week, after the country went nearly two months without a functioning government.

Complicating Libya's transition, the most powerful brigades of former rebels -- such as the Zintans, the Misratans and the Operations Room of Libya's Revolutionaries -- have loosely allied themselves competing political factions.

Former rebel commanders and protesters have also taken over key oil ports and pipelines, cutting Libya's oil output to 200,000 barrels per day from 1.4 million bpd to demand more autonomy and a greater share of oil wealth.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.