* Chaotic attack on parliament, clashes in Tripoli
* Forces loyal to former general demand GNC hand over power
* Attack comes after clashes in eastern city Benghazi (Adds details on deaths, context throughout)
By Ahmed Elumami and Ulf Laessing
TRIPOLI, May 18 (Reuters) - Heavily armed gunmen loyal to a renegade Libyan general stormed parliament on Sunday demanding its suspension and a handover of power to purge the North African country of Islamist militants.
Smoke rose over the General National Congress (GNC) after gunmen attacked and kidnapped ten staffers before withdrawing. Gunfire erupted across Tripoli, where rival militias clashed in some of the worst violence in the city since the end the 2011 war against Muammar Gaddafi.
Details of who was involved Sunday's chaotic attack were unclear, but loyalists of retired General Khalifa Haftar said his forces and militia allies had planned the parliament assault in a campaign to rid Libya of Islamist hardliners.
"We announce the freezing of the GNC," said Colonel Mukhtar Fernana, a former military police officer from the Zintan region, reading out on al-Ahrar TV a statement on behalf of Haftar's self-declared Libyan National Army.
He said their movement was not a coup, but said the parliament has no legitimacy and should hand over power to a 60-member body that was recently elected to rewrite Libya's constitution.
It was not immediately clear how much backing Haftar's men had within Libya's nascent regular armed forces and the country's powerful brigades of former rebels or whether the parliament was fully under government control after the attack.
The attackers kidnapped about 10 employees from the GNC, an official said. At least two people were killed and another 55 wounded in the violence, officials said.
Haftar, once a Gaddafi ally who turned against him over a 1980s war in Chad, fueled rumours a coup in February when he appeared on television in uniform calling for a caretaker government to end Libya's crisis.
Any alliance of militias challenging Islamist groups threatens to deepen chaos in the OPEC oil producer where a fragile government struggles to gain legitimacy and control brigades of former fighters who refuse to disarm.
Since the end of Gaddafi's one-man rule, the main rival militias of ex-rebels have become de-facto powerbrokers in the vacuum of Libya's political chaos, carving out fiefdoms and exercising their military muscle to make demands on the state.
But the most powerful, heavily armed brigades - the Zintans and the Misratans - are loosely allied with competing political factions determined to define what kind of state Libya should become three years after Gaddafi's fall.
The central government made no official comment on Sunday's attack, but Justice Minister Saleh al-Mergani called during a news conference on all parties to lay down their weapons and start dialogue.
Witnesses said armed local residents were blocking roads to the parliament building after the attack but their identities and affiliation were not clear.
Gunfire and explosions could still be heard until late at night on the airport road which is controlled by a brigade from Zintan, a staunchly anti-Islamist force.
Libyan news websites said forces from Zintan had initially stormed the parliament and then retreated to the airport road, but there was no confirmation from Zintan or the anti-Islamist Qaaqaa brigade about their involvement.
After Gaddafi, 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 its parliament caught up in constant infighting.
Libya's transitional parliament has been paralyzed by rivalries between the Islamist tied to Egypt's Muslim Brotherhood and a nationalist movement, leaving many Libya's frustrated over lack of progress since the war.
Haftar 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.
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.
Many former rebel fighters have been put on the government payroll to provide security to ministries and offices, but they often remain more loyal to commanders, political allies or their regional tribes than the state.
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. (Additional reporting by reporting Feras Bosalum; Writing by Patrick Markey; Editing by Rosalind Russell, Bernard Orr)