More than 27 people have been killed and 235 others wounded in Tripoli, authorities said, after gunmen opened fire on protesters who had called on armed groups to leave Tripoli.
The demonstration on Friday followed calls by imams during weekly Muslim prayers for protests against armed groups and former fighters who refuse to disarm and who pose a challenge to the central government, two years after the fall of Muammar Gaddafi in a NATO-backed uprising.
The existence of weapons outside the army and police is dangerous. All armed militias need to leave Tripoli without exception.
Hundreds of people carrying white flags as a sign of peace, as well as the national flag, sang the national anthem as they marched and assembled in the capital's Meliana Square.
They then marched to the Misrata armed group’s headquarters in the Gharghour district to press their demands before gunmen open fire.
The Libyan prime minister, Ali Zeidan, said all armed groups needed to leave Tripoli, without exception.
"The existence of weapons outside the army and police is dangerous," Zeidan said on Friday. "All armed militias need to leave Tripoli, without exception."
Robert Grenier, a former CIA agent, told Al Jazeera, "I think many people did see it coming as it is known that Gaddafi has systematically undermined the notion of government with his dictatorial grip on power."
"Despite the international community recognising the challenges once Gaddafi fell, his grip on power was always going to leave the vacuum which we see now."
Residents of Tripoli frequently demonstrate against the armed groups, who have rejected calls from a weak central government to leave the capital.
Libya has tried to co-opt different groups by paying them to provide security in Tripoli and other cities.
But the gunmen often remain loyal to their commanders rather than to the authorities.
Clashes between rival groups still break out in the capital, where Libya's nascent armed forces are still in training and cannot challenge the heavily armed groups.
Just weeks ago, armed men seized Zeidan and held him for several hours before releasing him.