Entire communities were swept out to sea in the North African country, with the city of Derna hit hardest.
A local health official in eastern Libya says the flood death toll in the city of Derna has risen to more than 5,100.
Ossama Ali, a spokesman for the Ambulance and Emergency Centre in eastern Libya, said the toll for the entire region is at least 5,202.
Ali told The Associated Press by phone on Wednesday that more than 7,000 people were injured in Derna and most of them received treatment at field hospitals that authorities and aid agencies set up there.
He says the number of deaths is likely to increase in the coastal city since search and rescue teams are still collecting bodies from the streets, buildings and the sea.
The startling death and devastation wreaked by Mediterranean storm Daniel pointed to the storm's intensity, but also the vulnerability of a nation torn apart by chaos for more than a decade. The country is divided by rival governments, one in the east, the other in the west, and the result has been neglect of infrastructure in many areas.
Outside help was only just starting to reach Derna on Tuesday, more than 36 hours after the disaster struck. The floods damaged or destroyed many access roads to the coastal city of some 89,000.
Footage showed dozens of bodies covered by blankets in the yard of one hospital. Another image showed a mass grave piled with bodies. More than 1,500 corpses were collected, and half of them had been buried as of Tuesday evening, the health minister for eastern Libya said.
10,000 still missing
But the toll is likely to be higher, said Tamer Ramadan, Libya envoy for the International Federation of Red Cross and Red Crescent Societies. He told a U.N. briefing in Geneva via videoconference from Tunisia that at least 10,000 people were still missing. He said later Tuesday that more than 40,000 people have been displaced.
The situation in Libya is "as devastating as the situation in Morocco," Ramadan said, referring to the deadly earthquake that hit near the city of Marrakesh on Friday night.
U.N. Secretary-General Antonio Guterres conveyed his solidarity with the Libyan people and said the United Nations "is working with local, national and international partners to get urgently needed humanitarian assistance to those in affected areas," U.N. spokesman Stephane Dujarric said.
The destruction came to Derna and other parts of eastern Libya on Sunday night. As the storm pounded the coast, Derna residents said they heard loud explosions and realised that dams outside the city had collapsed. Flash floods were unleashed down Wadi Derna, a river running from the mountains through the city and into the sea.
The wall of water "erased everything in its way," said one resident, Ahmed Abdalla.
Videos posted online by residents showed large swaths of mud and wreckage where the raging waters had swept away neighbourhoods on both banks of the river. Multi-story apartment buildings that once were well back from the river had facades ripped away and concrete floors collapsed. Cars lifted by the flood were left dumped on top of each other.
Libya's National Meteorological Center said Tuesday it issued early warnings for Storm Daniel, an "extreme weather event," 72 hours before its occurrence, and notified all governmental authorities by e-mails and through media ... "urging them to take preventive measures." It said that Bayda recorded a record 414.1 millimetres (16.3 inches) of rain from Sunday to Monday.
On Tuesday, local emergency responders, including troops, government workers, volunteers and residents dug through rubble looking for the dead. They also used inflatable boats to retrieve bodies from the water.
Many bodies were believed trapped under rubble or had been washed out into the Mediterranean Sea, said eastern Libya's health minister, Othman Abduljaleel.
"We were stunned by the amount of destruction ... the tragedy is very significant, and beyond the capacity of Derna and the government," Abduljaleel told The Associated Press on the phone from Derna.
Red Crescent teams from other parts of Libya also arrived in Derna on Tuesday morning but extra excavators and other equipment had yet to get there.
Flooding often happens in Libya during the rainy season, but rarely with this much destruction. A key question was how the rains were able to burst through two dams outside Derna – whether because of poor maintenance or sheer volume of rain.
440 milimetres of rain
Karsten Haustein, a climate scientist and meteorologist at Leipzig University, said in a statement that Daniel dumped 440 millimetres (15.7 inches) of rain on eastern Libya in a short time.
"The infrastructure could probably not cope, leading to the collapse of the dam," he said, adding that human-induced rises in water surface temperatures likely added to the storm's intensity.
Local authorities have neglected Derna for years. "Even the maintenance aspect was simply absent. Everything kept being delayed," said Jalel Harchaoui, an associate fellow specialising in Libya at the London-based Royal United Services Institute for Defense and Security Studies.
Factionalism also comes into play. Derna was for several years controlled by Islamic militant groups. Military commander Khalifa Hifter, the strongman of the east Libya government, captured the city in 2019 only after months of tough urban fighting.
The eastern government has been suspicious of the city ever since and has sought to sideline its residents from any decision-making, said Harchaoui. "This mistrust might prove calamitous during the upcoming post-disaster period," he said.
Hifter's eastern government based in the city of Benghazi is locked in a bitter rivalry with the western government in the capital of Tripoli. Each is backed by powerful militias and by foreign powers. Hifter is also backed by Egypt, Russia, Jordan and the United Arab Emirates, while the west Libya administration is backed by Turkey, Qatar and Italy.
Still, the initial reaction to the disaster brought some crossing of the divide.
The Tripoli-based government of western Libya sent a plane with 14 tons of medical supplies and health workers to Benghazi. It also said it had allocated the equivalent of $412 million for reconstruction in Derna and other eastern towns. Aeroplanes arrived Tuesday in Benghazi carrying humanitarian aid and rescue teams from Egypt, Turkey and the United Arab Emirates. Egypt's military chief of staff met with Hifter to coordinate aid. Germany, France and Italy said they also were sending rescue personnel and aid.
It was not clear how quickly the aid could be moved to Derna, 250 kilometres (150 miles) east of Benghazi, given conditions on the ground. Ahmed Amdourd, a Derna municipal official, called for a sea corridor to deliver aid and equipment.