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

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

Mosmary was an outspoken opponent of the Brotherhood, whose political wing is the second biggest party in the national congress, and regularly appeared on television criticising the presence of armed militias on Libya's streets. Two military officials were also killed in Benghazi on Friday.

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

The Muslim Brotherhood's political wing, the Justice and Construction Party (JCP) has the second-biggest number of seats in Libya's legislature, and there has been growing opposition to its increasing influence.

A Benghazi resident, Rami al-Shahibi, said protesters set on fire two buildings - one belonging to the Muslim Brotherhood and another to the JCP - in the city.

"They shouted "Gather your belongings. Benghazi wants you out,'" he said.

In Tripoli, a crowd gathered in the central Martyrs Square, saying they were there "in solidarity with Benghazi", a Reuters reporter at the scene said.

A group of youths then descended on the offices of the JCP, smashing its windows as well as taking out documents and throwing them in the streets.

They also ransacked the headquarters of the liberal National Forces Alliance (NFA), the biggest party in the legislature, a witness said.

Source: Reuters