BEIRUT - A massive explosion rocked Beirut on Tuesday, flattening much of the port, damaging buildings across the capital and sending a giant mushroom cloud into the sky. At least 50 people were killed and 2,700 injured, with bodies buried in the rubble, officials said.

Hours later, ambulances still carried away the wounded as army helicopters helped battle fires raging at the port.

The sudden devastation overwhelmed a country already struggling with both the coronavirus pandemic and an economic crisis: Beirut hospitals quickly filled beyond capacity, pleading for blood supplies and generators to keep their lights on.

The cause of the blast, which sparked fires, overturned cars and blew out windows and doors, was not immediately known.

Abbas Ibrahim, chief of Lebanese General Security, said it might have been caused by highly explosive material that was confiscated from a ship some time ago and stored at the port. Local television channel LBC said the material was sodium nitrate.

Witnesses reported seeing a strange orange-colored cloud over the site after the explosion. Orange clouds of toxic nitrogen dioxide gas often accompany an explosion involving nitrates.

An Israeli government official said Israel “had nothing to do” with the blast. He spoke on condition of anonymity because he was not authorized to discuss the matter with the media. Israeli officials usually do not comment on “foreign reports.”

The blast was stunning even for a city that has seen civil war, suicide bombings and bombardment by Israel. It could be heard and felt as far away as Cyprus, more than 200 kilometres (180 miles) across the Mediterranean.

“It was a real horror show. I haven't seen anything like that since the days of the (civil) war,” said Marwan Ramadan, who was about 500 metres (yards) from the port and was knocked off his feet by the force of the explosion.

Health Minister Hassan Hamad said the preliminary toll was at least 50 dead and 2,700 wounded. Emergency teams streamed in from across Lebanon to help, and the injured had to be taken to hospitals outside the capital. Hamad added that hospitals were barely coping and offers of aid were pouring in from Arab states and friends of Lebanon.

Some of those injured lay on the ground at the port, Associated Press staff at the scene said. A civil defence official said there were still bodies inside the port, many under debris.

Beirut's governor, Marwan Abboud, broke into tears as he toured the site, saying, “Beirut is a devastated city.”

Initially, video taken by residents showed a fire raging at the port, sending up a giant column of smoke, illuminated by flashes of what appear to be fireworks. Local TV stations reported that a fireworks warehouse was involved.

The fire then appeared to catch at a nearby building, triggering a more massive explosion, sending up a mushroom cloud and a shock wave.

Charbel Haj, who works at the port, said it started as small explosions like firecrackers. Then, he said, he was thrown off his feet by the huge blast. His clothes were torn.

Miles from the port, building facades were shredded, balconies were knocked down and windows shattered. Streets were covered with glass and bricks and lined with wrecked cars. Motorcyclists picked their way through traffic, carrying the injured.

One woman covered in blood from the waist up walked down a trashed street while talking furiously on her phone. On another street, a woman with a bloodied face looked distraught, staggering through traffic with two friends at her side.

“This country is cursed,” a young man passing by muttered.

The blast came at a time when Lebanon's economy is facing collapse from the financial crisis and the coronavirus restrictions. Many have lost jobs, while the worth of their savings has evaporated as the currency has plunged in value against the dollar. The result has thrown many into poverty.

It also occurred amid rising tensions between Israel and the militant Hezbollah group along Lebanon's southern border.

The explosion was reminiscent of massive blasts during Lebanon's civil war and took place only three days before a U.N.-backed tribunal was set to give its verdict in the killing of former Prime Minister Rafik Hariri in a truck bombing more than 15 years ago. That explosion, with a ton of explosives, was felt miles away, just like Tuesday's explosion.

Several of Beirut's hospitals were damaged in the blast. Roum Hospital put out a call for people to bring it spare generators to keep its electricity going as it evacuated patients because of heavy damage.

Outside the St. George University Hospital in Beirut's Achrafieh neighbourhood, people with various injuries arrived in ambulances, in cars and on foot. The explosion had caused major damage inside the building and knocked out the electricity at the hospital. Dozens of injured were being treated on the spot on the street outside, on stretchers and wheelchairs.

“This is a catastrophe we have on our hands,” said one doctor, speaking on condition of anonymity because he was not authorized to make press statements.

Associated Press writer Sarah El Deeb in Beirut and Josef Federman in Jerusalem contributed.