MOGADISHU, SOMALIA -- The night sky over Mogadishu fills with streaking red tracer bullets fired from hundreds of guns. The loud cracks and fireworks are virtually constant, a joyful expression of celebration, locals say, over the end of 21 years of rule by dictator Mohamed Siad Barre.

Many people indeed are jubilant in this impoverished, battle-scarred capital. Victorious rebels of the United Somali Congress, weapons raised high, cram pickup trucks and cruise the rubble-strewn city, a few singing or chanting "Gulu" -- victory in Somali.

But this week, after Siad Barre and his soldiers were forced out of town by the rebels last Saturday night, many other citizens were gleefully taking advantage of the breakdown in law and order -- not to celebrate, but to tear into scores of downtown shops and businesses, ripping down even the sturdiest wrought-iron obstruction with crowbars and their bare hands to loot whatever they could find.

To a visitor, this Indian Ocean port city provokes unsettling sensations. It is a place where people on the street often greet a stranger with a ready smile, a warm hello and a hearty wave -- not of a hand, but of a pistol, rifle or knife.

From the air, the tropical capital, boasting whitewashed buildings and fronting miles of turquoise sea and sandy beaches, looks postcard-perfect. From the ground, it seems more like a chamber of horrors.

Here, unburied corpses are often located at first not by sight, but by smell -- a stench emanating from back alleys, abandoned buildings, street corners and other sites where firefights and summary executions took place in the past five weeks. During that period, rebel and government forces engaged in battles believed to have claimed thousands of civilian lives.

"We are detailing a committee to begin to deal with this problem," said Abdul Osman, a representative of the rebels, when asked when Mogadishu's dead will be buried.

The rebels, who have promised to form a broad-based government and hold elections leading to democratic rule, say hundreds of bodies have been picked up and buried in mass graves. They admitted, however, that many others remain. During a four-hour tour of the city, hundreds of people were seen stealing and firing pistols and automatic weapons in the air, but no one was seen burying a single body.

A vague scent of fresh blood hangs in the air in other parts of Mogadishu, notably in the city's only functioning hospital on the north side, a sorrowful place resembling a butcher shop where numerous civilians, including children, wait in agony for treatment for bullet wounds.

While the city's residents clearly are reveling in the downfall of Siad Barre -- a former army commander accused of ordering the murders of political rivals and numerous other atrocities against civilians -- much has been destroyed here and Somalis face a difficult period of physical as well as psychological healing.

Tons of rubble, twisted girders and fallen trees riddle the streets. Electricity, water and fuel supplies are either extremely scarce or cut off entirely. Schools, homes, hospitals and government offices are now burned shells, cratered and pockmarked by artillery shells and fire.

But the most daunting task facing the future holders of political power in Somalia may be the security of the people themselves. This is a city where the social fabric has been turned inside out by lawlessness and violence. In a place where disorder appears to be the only order of the day, nearly everyone seems to feel they must be armed -- and they are.

Mogadishu is a city of guns that come from all parts of the globe: the United States, the Soviet Union, China, Egypt, Italy, Britain, Libya, France, Pakistan.

Of all the legacies the Siad Barre regime bequeathed to the Somali people, the rule of the gun -- indeed, the very ubiquity of firearms in this East African country -- may be the most dominant and enduring.

"Yes, I have one. A Kalashnikov," said Osman, 33, a lanky, well-dressed man trained as an economist who worked for the Ministry of Posts and Telecommunications before the upheaval. "You have to have a gun to live in Mogadishu. If you don't, you are at the mercy of anyone who does. That is the main law."

This culture of firearms and violence greets a visitor almost immediately upon arrival at Mogadishu airport, where armed youths roam the runway and the walls of the air control tower are newly splattered with blood. At the airport, a Somali explains, the civil war took the form of a grudge battle between the chief controller and his workers. The chief lost. He was shot in the face.

For years during the Cold War, Siad Barre deftly played the superpowers against each other, procuring an estimated $1 billion in Soviet weapons during the 1970s, and hundreds of millions of dollars more in U.S. arms during the last decade, when the United States considered Somalia a strategic ally. The regime received arms from other sources as well, including China and Egypt.

The government used these weapons in a disastrous war against Ethiopia over the Ogaden region in 1977-78, and to stamp out internal political opposition by rebels.

Among a largely pastoral people proud of a warrior tradition in which life and property have been protected for ages with the most rudimentary of weapons, the shiploads of automatic arms, grenade launchers, tanks, heavy artillery and tons of ammunition provided by the world's gun merchants found a welcome home. Many of the small arms ended up on the open market, selling cheaply and falling into the hands of civilians and rebels.

The real price the country paid for allowing in the arms -- not just in money but in lives -- became clear during the past five weeks, when gunners at the presidential palace fired hundreds of U.S.- and Soviet-made artillery shells, raining them on homes, churches, mosques and businesses. No one knows how many died; the rebels say at least 2,000.

For the foreseeable future, the culture of guns probably will continue. Interim President Ali Mahdi Mohamed said the security situation in Mogadishu constitutes one of his chief concerns.