MOGADISHU is no stranger to the sounds of mortar and machinegun fire. And once again last Friday, Somalia’s capital city found itself becoming a frontline.

For two weeks now the country has been in a constitutional crisis after ­Somalia’s president Mohamed Abdullahi ­Mohamed – universally known by his nickname “Farmajo” – refused to leave ­office after his term expired and an agreed upon ­election date of February 8 elapsed.

Angered by the delayed elections, ­opposition demonstrators on Friday took to the streets only to be met by government forces and Mogadishu found itself engulfed in gun battles.

“Many forces heavily attacked us; I am now on my chest in an alley. This is a ­massacre,” protester Farah Omar told Reuters news agency by phone. He said Turkish-trained special forces troops known as Gorgor were among those ­attacking demonstrators.

READ MORE: David Pratt: Ten years on from revolution, Libya needs global support

This is a dangerous moment for ­Somalia. For not only does it now in ­effect, lack a legitimate government, but this is ­happening in a country where the fighting has the potential to spread ­quickly. Ever since 1991 Somalia has been ­intermittently riven by civil war and is a place where clan loyalties matter ­enormously.

While President Mohamed is from the powerful Darod clan, most military units in and around Mogadishu are from the Hawiye clan, which is heavily represented in the opposition alliance. On both ­government and opposition sides, they can, in an instant, call on heavily armed supporters in a region awash with arms.

Only a few days before Friday’s clashes, the US Navy seized a large cache of ­weapons being smuggled by two small boats off the coast of Somalia. Thousands of Kalashnikov rifles, light machine guns, heavy sniper rifles and rocket propelled grenade launchers were among the haul. While analysts believe they were most likely en-route to neighbouring war-torn Yemen, this has not yet been ­confirmed and the weapons seizure is a stark ­reminder of the arms trafficking network and vast arsenals available in the region.

For some reading this, Somalia might seem like a faraway country of little ­significance. But time and again over the past decades the country’s travails and torment have impacted in ways and ­places far beyond the borders of this coastal ­nation on the Horn of Africa.

It was back in 1991 that President ­Mohamed Siad Barre was ousted and power struggles between clan warlords killed or wounded thousands of ­civilians. So massive was the famine resulting from this civil war, that US Marines were ­landed near Mogadishu ahead of a UN peacekeeping force sent to restore order and safeguard relief supplies.

In actual events later depicted in the movie Black Hawk Down, US Army ­Rangers were killed when Somali ­militias shot down two US helicopters in ­Mogadishu after which in the ensuing ­battle hundreds of Somalis died.

Bedevilled by such setbacks, by 1994 the UN mission formally ended, and the following year peacekeepers left, having failed to achieve their mission.

Since then. Islamist-inspired extremists most recently Al-Shabaab, which was also responsible for attacks in neighbouring in Kenya, have continued to destabilise ­Somalia despite tremendous efforts by some officials, organisations, and others to get the country back on its feet.

READ MORE: David Pratt: The biggest loser of Trump's impeachment trial was America itself

It would be wrong to underestimate just how easily Friday’s violence could ­escalate in Somalia. Most observers are agreed that this is now far more ­serious than the mere “electoral impasse” ­suggested by the European Union and that it’s time to recognise it for the grave constitutional crisis that it is.

“It is essential to make sure that this country does not go back to where it came from,” insisted Hassan Ali Khaire, a former prime minister and presidential candidate, who was one of the opposition leaders leading Friday’s march. This of course was a reference to the instability that has dogged Somalia for decades and resulted at one point in Mogadishu being declared the most dangerous city in the world.

During one of my earliest visits to the city back in 2002, I found myself landing by small plane on a dirt airstrip some miles outside of Mogadishu. In cinemas back home, the Black Hawk Down had just opened. Somalia was on the public as well as political radar and everywhere the talk was of the so called “War on Terror”.

Despite by then having had experience of many other war-torn cities, nothing could have prepared me for the chaos and carnage of Mogadishu.

In the eerie no-man’s land that divided the north and south of the city, rival militias had turned it into a lair of looters and shooters.

In the shell smashed ruins, old Cinzano signs – a hangover from Somalia’s Italian colonial past – remained pinned to walls so peppered with bullet holes they looked like Swiss cheese.

Elsewhere on the streets, telephone poles leaned at ominous angles like ­voodoo totems, the stubs of their severed tops long since stripped of wires for sale in the black market.

Along the city’s once-languid boulevards everything was awash with garbage and sand, the humid wind coming off the Indian Ocean leaving a wavering sea of blue and pink plastic bags hanging from every scrap of withered vegetation. Even today Mogadishu’s citizens still refer to these as “Somali flowers”.

IF the city was awash with garbage, then the same could be said of guns. In Mogadishu’s infamous Bakara district “sky shooters” weapons market, a Russian Kalashnikov assault rifle cost a mere $150, while an American M-16 type was much cheaper because of the difficulty in getting ammunition.

Mortars, grenade launchers, heavy ­machine guns, all were readily available for those with money to buy.

READ MORE: David Pratt: How the SNP's independence strategy is influencing the Catalans'

Years later during another visit things had improved, and Mogadishu appeared to be rising from the ashes after a more stable period of government. But such was the threat from al-Qaeda-linked Al-Shabaab extremists, that the 24 – hour protection of an eight-man squad of ­heavily armed local bodyguards was ­necessary throughout my time there.

Despite such threats however, a ­succession of Somali leaders and their ­foreign partners have worked hard to both physically rebuild the country and those institutions of governance, including representative elections. This is precisely why so much is now at stake because of the latest crisis and escalating violence.

“It’s a moment of great uncertainty. There’s still no consensus on how to move forward and the opposition is getting frustrated,” observed Omar Mahmood, senior analyst for Somalia at the International Crisis Group (ICG).

“This has resulted in the clashes in Mogadishu this morning, as they moved ahead to organise protests,” Mahmood was quoted by The Washington Post as saying as events unfolded in Mogadishu on Friday.

To understand where things might go from here it’s important to understand political events leading up to Friday’s ­volatile tipping point. To begin with the goal of direct, one-person-one-vote ­election in Somalia has persistently ­remained elusive. That was supposed to happen this time, but instead, the federal government and states agreed on another “indirect election”, with senators and members of parliament elected by community leaders – delegates of powerful clans – in each member state. Members of parliament and senators then elect ­Somalia’s president.

It’s a complicated election process which some have said is like a localised version of the US Electoral College ­system. This has meant that the country has not directly chosen a president since 1969.

But an alliance of opposition ­leaders, along with civil society groups, have ­objected to this system, arguing it leaves them no say in the politics of their own country. And adding to these ­objections the regional states of Jubaland and ­Puntland which also form part Somalia’s complex and fragile federal system also refused to take part.

While talks to break the deadlock were scheduled for last week, frustrations among the opposition led them on to the street for Friday’s demonstration, to which government forces reacted. Both sides blame each other for starting the ­violence, but whoever fired the first shot is less important now than the urgent need to calm the situation before it ­spirals out of control. Some of those closest to understanding what is happening on the ground however appear far from ­confident that this can be achieved.

“The military is dissolving and many troops seemingly reverting to clan ­loyalties,” said Colonel Ahmed Abdullahi Sheikh, who served for three years until 2019 as the commander of Somalia’s elite US-trained Danab unit.

“It’s a mess. There’s no longer any command structure whatsoever,” he told ­Reuters on Friday.

READ MORE: How persecution and superpower politics effect oppressed Uighur and Rohingya minorities

“My fear is that many SNA (Somali ­National Army) outstations will leave their bases to come and participate in the fighting and give more ground to Al-Shabaab. This will really empower Al-Shabaab. Over a decade’s worth of gains might be lost,” Sheikh went on to warn.

According to some analysts, Al-Shabaab’s command structure has been recently reshuffled and the latest instability has presented an ideal situation in which its new leaders will try to prove themselves. Al-Shabaab regularly ­shatters Somalia’s attempts at peace and is already in control of vast areas of central and southern Somalia.

Back in Mogadishu meanwhile, some international observers believe a key to unlocking the standoff between government and opposition lies in rejecting the involvement of the outgoing president,

“Farmajo is himself responsible for ­creating this situation by having stymied negotiations over the electoral framework,” observed Theodore Murphy, ­Director of the Africa programme at the European Council for Foreign Relations.

“With his tenure ended, and lacking widespread Somali popular support, he should be treated as nothing more than a political party representative, not the sitting president,” Murphy added, in an online article just before events on Friday unfolded making it even more difficult to find a solution.

He makes the case too that Somalia’s federal government is still a provisional authority, that requires the nation’s leadership to carry out three core tasks to complete Somalia’s political transition.

These are, review the provisional constitution, build out the federal architecture, and develop an appropriate electoral system. It is the failure by Somalia’s government to overcome these albeit formidable challenges argue Murphy, that lie at the heart of Somalia’s persistent instability and insecurity.

Some Somali opposition leaders also say that those within the international community who had partnered with the government of Farmajo these past years and still insist on calling him president despite his term having expired, were standing in the way of a solution.

“We expect the international community to exercise its leverage after having given billions of dollars to this country and this government,” said Abdirahman Abdishakur, the opposition leader who called Friday’s protests.

READ MORE: Myanmar coup: China will be watching events unfold with special interest

‘Why else are you here? Why fuel impunity instead of accountability? He will understand only that he can do whatever he wants. Say out loud that his mandate is over,” Abdishakur was cited as saying by news organisations on Friday.

This weekend, alarmed by the latest instability and all too aware of the dark days Somalia has seen so many times in the past, the UN said it is “deeply concerned.”

It has called for “calm and restraint by all parties involved” and urged “that open lines of communication be maintained to help reduce tensions”.

MANY years ago, when I first visited ­Somalia, it seemed like a country ­conjured up by central casting in terms of a failed state. So anarchic, violent, and complex were its divisions it appeared all but unsalvageable.

Years later, while on other visits I still found Mogadishu a scary place but one coming back to life.

Other great cities like Beirut and ­Sarajevo have bounced back from recent wars to recapture their former glory, why not Mogadishu? I thought. Some hopeful signs were beginning to show through.

READ MORE: Russia: As pro-Navalny protests grow, are things about to change?

Though still a crowded, crumbling, cratered city, for the first time in many years there had been a comparative lull in the violence. It was not definitive, it was not complete but was enough to allow its residents to breath and tentatively rebuild, even if the shadow of al-Shabaab lingered menacingly.

Friday’s violence was a wake-up call and for the time being remains a dangerous moment.

What a tragedy it would be if Somalia were unable to find a negotiated way out of its latest crisis and slip back into civil war. For as its recent history has repeatedly shown, the human cost would be catastrophic.