Twenty years since Somali fighters shot down two American Black Hawk helicopters, Somalia's leader said Thursday that his battle weary nation had emerged from the "ashes of war."

The speech, to commemorate the deaths on both sides in the intense two-day battle between Somali militia fighters and US forces, said a nation that had become a byword for anarchy was now making steps forward.

"Somalis have known nothing but conflict and suffering for two decades, today we have at last emerged from the ashes of war," President Hassan Sheikh Mohamud said in a speech.

"As we celebrate our recovery we also mark with sadness and respect the lives lost on both sides in the madness of that conflict and we say firmly, never again."

The October 3-4 battle in 1993, which drew further attention after the 2001 Hollywood film "Black Hawk Down," was a defining moment for international engagement with Somalia.

US forces staged a raid to capture self-declared president and powerful warlord Mohamed Farrah Aidid, but after the two helicopters were shot down, fierce fighting broke out, in which 18 US soldiers and at least several hundred Somali fighters were killed.

The UN's intervention in Somalia, dubbed "Operation Restore Hope" in the 1990s, collapsed after the battle.

But Mohamud's government is the first to be given global recognition since the collapse of the hardline regime in 1991, and billions in foreign aid has been poured in, including from Washington.

"Many people around the world know Somalia only through the distorted lens of Black Hawk Down," Mohamud added. "Yet, Somalia has moved on into a new chapter with a recognised government that is healing the wounds of war."

Partial remains of the helicopter, covered in thick cactus, were still visible earlier this year in a sidestreet in Bakara market, Mogadishu's commercial centre.

Still, while the capital is rapidly rebuilding, the situation elsewhere remains bleak.

Al-Qaeda-inspired fighters, breakaway regions, rival clans and an ongoing climate of rampant insecurity have conspired to ensure much of the Horn of Africa nation remains saddled with its basket case image.

Islamist Shebab insurgents, who still control much of rural southern Somalia, last month claimed responsibility for an attack on a Nairobi shopping mall, in which at least 67 people were killed.