* 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 (Details on more clashes in south, context)
By Ahmed Elumami and Ulf Laessing
TRIPOLI, May 18 (Reuters) - Heavily armed gunmen stormed Libya's parliament on Sunday to demand the legislature be suspended in an attack claimed by a renegade former army general who has vowed to purge the country of Islamist militants.
In a chaotic attack, smoke rose from the parliament after gunmen stormed the General National Congress (GNC), raided offices and withdrew. Heavy gunfire erupted across Tripoli, where rival brigades of ex-rebels have often clashed since ending the 2011 war against Muammar Gaddafi.
Details of who carried out Sunday's 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.
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, the country's powerful brigades of former rebels or whether the parliament was fully back under government control after the attack.
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 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.
The attackers kidnappped about 10 employees from the GNC, an official said.
There was no immediate comment from the central government.
There was no confirmation either from other militias of their involvement, including the powerful Zintan and Qaaqaa brigades that fiercely oppose Islamist factions in Libya's parliament and the rival brigades who support them.
Any lining up of militias against Islamist groups could increase chaos in the OPEC oil producer where a fragile government is struggling to gain legitmacy and control brigades of former rebels who refuse to disarm and challenge the state.
Haftar, a former rebel in the conflict 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.
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 paralyzed by infighting. (Additional reporting by reporting Feras Bosalum; Writing by Patrick Markey; Editing by Rosalind Russell, Bernard Orr)