Libyan militiamen have attacked peaceful protesters demanding the disbanding of the country's armed groups, killing at least 22 people as they opened fire on the march with heavy machine guns and rocket-propelled grenades.
Witnesses said protesters went home to gather weapons and later returned to the site of the attack, suggesting more bloodshed was possible.
The country's grand Mufti called on protesters to end their demonstrations and said he held the government responsible for ending militias' presence in the capital.
The march in the capital Tripoli by thousands of protesters was the biggest show of public anger at militias in months.
Since the 2011 fall of dictator Muammar Gaddafi, hundreds of militias - many of them on the government payroll - have run out of control in Libya, carving out zones of power, defying state authority and launching violent attacks.
The protesters marched from a downtown mosque to the headquarters of a militia originally from the city of Misrata that has a powerful presence in Tripoli.
They waved Libyan and white flags and chanted, "We want an army, we want police," referring to demands that the country's weak security forces take the place of militias.
When they neared the building, militiamen in civilian clothes and military uniforms came out of the headquarters, opening fire at the protesters with automatic weapons, RPGs and anti-aircraft guns. Footage aired on the privately owned al-Nabaa television network showed protesters running from gunfire while carrying others covered in blood.
An official at Tripoli Emergency Hospital said it had the bodies of 15 protesters. Libya's official news agency LANA quoted a medical official at Tripoli's Central Hospital as saying it had the bodies of seven protesters, bringing the death toll to at least 22. The agency said the attack wounded more than 130 people, leaving many in a critical condition.
Hanan Saleh, a Human Rights Watch researcher in Tripoli, told AP that she counted seven bodies at one morgue.
"The situation is very chaotic. Armed men are running around," she said. She added: "We expect more dead."
Militiamen also beat a reporter and a photographer before protesters ultimately rescued them. After the attack, some protesters marched back to the mosque while others remained close to the militias' headquarters. Many demanded the head of Tripoli city council to use force to expel the armed men.
Al-Taher Basha Agha, commander of Misrata-based militia, vowed in a telephone interview with Libya al-Ahrar that Misrata militias will leave only "dead bodies".
He accused protesters of opening fire first.
"Who is the person who is inciting them?" he said. "The evil ones who are using the civilians as a bridge to cross to power."
The commander offered this threat: "Tripoli has not seen a war yet, it will see it soon."
Protester Mahmoud Taquiya, a computer engineer, said that the protesters carried white flags to show that they were peaceful.
"We didn't expect this to happen," he said. "There will be no end to protests until the militias are out. When we are done with this one, we will move to others."
LANA agency reported that the Ministry of Defence assigned two battalions to deploy forces to the site of the attack. It quoted Ali al-Shekhli, the spokesman of the chief of staff, as saying that orders were given to separate the protesters and the militia. He also said the military had orders to shoot anyone who was hostile.
Libya's prime minister Ali Zidan blamed both the protesters and militiamen for the violence, saying that the protesters were armed.
Mr Zidan said: "You can't open fire at people who are exchanging fire."
Witnesses there said they saw no weapons among the protesters.
Mr Zidan also said that after the government gave permission to protesters to hold their demonstrations in front of a mosque in Tripoli, protesters instead marched to the headquarters of the militia group.