The militias are holdovers from the 2011 uprising that ousted dictator Muammar Gaddafi and are a powerful force in the increasingly lawless North African country.
"Fifteen dead and 95 wounded, several of them seriously, have been admitted to Tripoli hospitals," a health ministry spokesman said.
He was unable to give a breakdown between those killed in the demonstration and those who died in a subsequent assault on the militia headquarters.
"It's total confusion," he said.
Violence erupted when gunmen fired at hundreds of demonstrators carrying white flags from inside villas in the southern Tripoli district of Gharghour where the Misrata militia has its headquarters.
The shooting sparked a violent response in which armed men assaulted the villas and set them on fire.
A witness, who identified himself only as Ibrahim, said "most of the members of the militia barricaded themselves inside one single villa."
He later said the militiamen had evacuated the final villa and fled, adding that some militiamen had been wounded and others arrested.
Other witnesses said heavy gunfire could be heard in Gharghour and that smoke was rising from the district.
Sadat al-Badri, president of Tripoli's city council, which called for the protest, told AFP the shots fired at demonstrators came from inside the headquarters.
"Tensions are on the rise in Tripoli. We're going to announce a general strike and launch a civil disobedience campaign until these militias leave," he said.
In sermons at weekly Muslim prayers earlier in the day, imams backed the call to protest against militias issued by the town hall as well as Libya's mufti, the highest religious authority.
'No to militias'
Hundreds of people carrying white flags in a sign of peace, as well as the national flag, and singing the national anthem had assembled in the capital's Meliana Square.
"No to militias," their banners read. "Yes to the police and army."
The protesters, among them children, then marched to the Misrata militia headquarters in Gharghour to press their demands when gunmen inside fired into the air to scare them off.
When the crowd continued to approach the building, the gunmen started firing at them, said an AFP correspondent who saw two wounded, including one hit in the stomach.
A rocket also crashed into the main road near the demonstrators, without causing casualties, the correspondent said.
A leader of the militia from Misrata, east of the capital, told private television channel Al-Naba the demonstrators had opened fire first.
Before the villas were attacked, pick-ups loaded with anti-aircraft guns were seen headed for the area of the militia headquarters later Friday, witnesses said.
Regular security forces were not sighted, apart from the air force making low passes over the capital.
The mufti, Sadok al-Ghariani, appealed to residents to go home to avoid further bloodshed, while the health ministry called for blood donations to Tripoli hospitals.
The march was sparked by violence on November 7 in which the Misrata militia also played a central role and which terrorised Tripoli residents and illustrated again growing instability in Libya.
A Misrata militia chief, Nuri Friwan, had been fatally wounded in fighting at a checkpoint manned by other ex-rebels, and two people were killed in subsequent fighting.
Residents of Tripoli frequently demonstrate against the militias, who have rejected calls from a weak central government to leave the capital.
Last year, around 30 demonstrators were killed as anti-militia protests turned into violent clashes in the eastern city of Benghazi.
The rebels who overthrew Kadhafi were hailed as heroes for bringing an end to more than four decades of dictatorship.
But many have rejected government demands to turn in their weapons or join the national security forces, posing a constant threat to the stability of post-Kadhafi Libya.