The stench of decomposing bodies and burning garbage hung over the city as it faced a potential humanitarian catastrophe due to collapsing water and power supplies, shortages of medicine and no effective government.
The rebels now in control of most of Tripoli vowed to take Gaddafi's home town of Sirte by force if negotiations with loyalists in one of their last strongholds there failed.
As the fighting ebbed away in the capital, more and more bodies were found. Some were Gaddafi soldiers who perished, while others appeared to have been executed. Still more were found in the grounds of a hospital abandoned by its doctors.
A correspondent for Britain's Sky News said he had counted about 53 bodies left in a burned-out warehouse, where they were apparently executed earlier this week.
"It is a scene of mass murder," Stuart Ramsay said at the scene, quoting witnesses as saying 150 people were killed there on Aug. 23 and 24 as rebel fighters fought pro-Gaddafi forces.
A resident told Sky the victims were mostly civilians and had been killed by Gaddafi's forces.
In the Tajoura district of the capital, local people prepared a mass grave for the bodies of 22 African men who appeared to have been recruited to fight for Gaddafi. One of the dead had his hands tied behind his back.
"The rebels asked them to surrender but they refused," said resident Haitham Mohammed Khat'ei.
"Residents of the neighbourhood decided to bury them in accordance with Islamic law," he told Reuters.
Reports of cold-blooded killings by both sides have surfaced in the last few days, darkening the atmosphere in a city where many residents had greeted Gaddafi's fall with joy.
Gaddafi's own whereabouts remain unknown -- rebels hunting him say the war will not end until the 69-year-old colonel, who kept Libya
in his grip for 42 years, is captured or killed.
Mustafa Abdel Jalil, head of the rebel National Transitional Council
(NTC), told reporters in Benghazi: "We have no factual report about the whereabouts of Gaddafi and his sons."
The NTC, which has told its fighters not to carry out revenge killings, is trying to assert its authority and restore order in Tripoli but its top officials have yet to move there from their Benghazi headquarters in the east.
Rebel commanders are still negotiating with Gaddafi loyalists to try to persuade them to surrender control over the coastal city of Sirte, Abdel Jalil said.
Libya is effectively cut in two by pro-Gaddafi forces holding territory stretching southwards from Sirte, 450 km (300 miles) east of the capital, deep into the desert.
A rebel commander said forces advancing from the east had reached the edge of Bin Jawad, a town about 140 km from Sirte.
"We are waiting for the people in Sirte to come out and talk but we've got no answer up to now. I've been waiting for three days," the commander, Fawzi Bukatif, told Reuters, adding that Sirte must be taken eventually by force or peaceful means.
With rebel forces approaching from east and west, Gaddafi loyalists in Sirte could retreat into the desert and try to reach Sabha, another Gaddafi stronghold far to the south.
"If they pull south to Sabha, we'll follow them. We're determined to clear the whole country," said Bukatif.
The rebels, still a long way from Sirte, have been using artillery backed by NATO air strikes on the town.
Far to the west, rebels were in control of the border post of Ras Jdir after clashing with pro-Gaddafi forces on Friday, but there was almost no traffic through what is usually a lifeline for food, fuel and medical supplies for Tripoli.
Rebels there said this was partly due to rearguard attacks by Gaddafi's soldiers and partly to roadblocks manned by pro-Gaddafi tribesmen on the Tunisian side of the border.
"It's the Al-Shusha tribe, the Hawamid tribe. They love Gaddafi and are stopping the traffic, smashing cars and beating families," said Walid Suleiman, 31, a rebel fighter.
Also in the west, rebels seized the small desert town of Jmayl, home of Gaddafi's prime minister, who has left the country.
Nearby in the port of Zuwara about 160 km (100 miles) west of Tripoli, a ship carrying ammunition for the rebels exploded and rebels pointed the finger at Gaddafi saboteurs.
"The fifth column, they blew up a boat carrying ammunition and bombs and then ran off," said Salah Al-Tahar, a rebel fighter.
NTC spokesman Mahmoud Shammam also reported attacks near Zuwara. "The Gaddafi brigades are shelling the road, but we hope to be able to control it today," he said.
The NTC and the Western powers that backed rebel forces with a five-month bombing campaign are acutely aware of the need to prevent Libya collapsing into the kind of chaos that plagued Iraq for years after the U.S.-led invasion of 2003.
Life remains far from normal in Tripoli, whose two million people are grappling with a breakdown in basic services, even as many of them celebrate the overthrow of a hated leader.
In one hospital, wounded patients lay on bare mattresses in bloodsoaked bandages amid a stench of blood and sweat. None was on an intravenous drip, although many had lost blood.
"There are widespread shortages of fuel, food and medical supplies, particularly in the Nafusa Mountains and Tripoli," U.N. Secretary-General Ban Ki-moon said in New York.
Tripoli's supply problems have worsened, even though NTC chairman Mustafa Abdel Jalil said on Thursday his forces had discovered huge stockpiles of food and medicine in the capital that would eliminate any shortfalls.
NTC spokesman Shammam said the council wanted staff at the National Oil Corporation, the de facto energy ministry, to get back to work and tackle shortages of petrol, fuel oil and gas.
He said diesel and cooking gas cargoes were on the way and that talks had taken place at the Zawiyah refinery to discuss ways to supply western Libya with gas and restart the refinery.
MOUNTAINS OF RUBBISH
In Tripoli, stinking garbage was piled high in the streets. In some districts, people set it on fire to stave off disease.
Electricity and running water were scarce. Residents carried containers to mosques, which often have wells, hoping to fill up. Outside one mosque, a sign read: "No water left."
In Abu Salim, bullet casings littered a square. About 50 charred cars dotted the neighbourhood.
Dozens of decomposing bodies still lay in and around a hospital in Abu Salim that was abandoned by medical staff during the fighting. It was not clear how they had died.
Five bloated bodies lay on trolleys at the entrance to the emergency department, while 25 lay in the garden, wrapped in rugs and sprinkled with lime in a vain attempt to keep down the smell. Surgical masks and gloves were scattered on the ground. Ambulances were still parked in front of the hospital.
The rebel council is pressing foreign powers to release Libyan funds frozen abroad to help it restore security, provide services and revive the economy after six months of conflict.
The United States and South Africa struck a deal on Thursday to allow the release of $1.5 billion in frozen Libya funds for humanitarian aid and other civilian needs.