Protesters attacked offices of Libya's Muslim Brotherhood and the headquarters of a liberal coalition after demonstrations sparked by assassinations in the eastern city of Benghazi turned violent, witnesses said.

Hundreds took to the streets overnight to denounce the killing of a prominent political activist and critic of the Brotherhood, Abdelsalam al-Mosmary, who was shot dead on Friday after leaving a mosque.

Mosmary was an outspoken opponent of the Brotherhood, whose Islamist political wing is the second biggest party in the national congress. Two military officials were also killed in Benghazi on Friday.

Libya's government is struggling to assert its authority over armed groups that helped topple veteran leader Muammar Gaddafi in 2011, part of the wave of Arab Spring uprisings that also felled autocrats in Tunisia, Egypt and Yemen.

Protesters in Benghazi set fire to two buildings - one belonging to the Muslim Brotherhood and another to its political wing, the Justice and Construction Party (JCP), witnesses said.

In Tripoli, a crowd stormed JCP headquarters before heading on to ransack the headquarters of the liberal National Forces Alliance (NFA), the country's biggest political party founded by wartime rebel prime minister Mahmoud Jibril.

There has been rising opposition to the influence of the Muslim Brotherhood, which has links to several government ministers.

It has struggled to convince Libyans wary of foreign interference that it has no financial or administrative links to its namesake in neighbouring Egypt, whose Islamist president Mohamed Mursi was overthrown by the military on July 3.

Tensions are also high between secularists and the ruling Islamists in Tunisia, where the funeral of an assassinated secular politician was taking place on Saturday.

"THE STATE HAS FAILED"

Many of the Libyan protesters accused the Brotherhood of being behind the killings in Benghazi, cradle of the 2011 revolution - a charge rejected by Abdulrahman al-Dibani, a JCP member in congress.

"We have strongly condemned the assassination of Mosmary and all the Libyan people should hear this and not openly blame us," he said.

Reached by phone, Bashir el-Kubti, head of the Muslim Brotherhood in Libya, declined to comment on the attacks on the movement's offices.

Libyans are growing increasingly frustrated as they witness continuous political squabbling and lawlessness across the north African country, a major oil producer.

"The people were in the streets because they are fed up of all political parties and how the state has failed," said Hisham Idris, who had demonstrated in Tripoli's Martyrs Square.

"Maybe the growing opposition to the Muslim Brotherhood is because they are trying to achieve their political ambitions using religion as a cover for their agenda."

The Tripoli protesters waved Libyan flags and shouted anti- Brotherhood slogans. A group of youths then descended on the JCP offices, smashing its windows, climbing on desks, grabbing documents and throwing them in the streets.