Gunfire broke out in Mogadishu on Friday as the opposition tried to march against delayed elections in the Somali capital where roads have been sealed off and heavy security deployed over the planned protest, witnesses said.

It was unclear who opened fire first, but one witness Yusuf Mohamed reported a "heavy exchange of gunfire" between security forces and armed guards protecting opposition supporters who began their march along the main airport road.

"There can be casualties but we are taking cover now I don't know exactly what happened," he told AFP.

Another witness Fadumo Moalim said: "We were peacefully walking along the airport road together with former prime minister Hassan Ali Kheire, when the security forces opened fire on us, creating mayhem."

The violence comes after weeks of tensions over the holding of delayed elections in the Horn of Africa nation.

A coalition of opposition candidates is calling for President Mohamed Abdullahi Mohamed, better known by his nickname Farmajo, to step down after his term expired on February 8.

The deadline to hold indirect elections was missed as the country's semi-autonomous regions squabbled over how to conduct the vote.

Farmajo is to hold a meeting with regional leaders on Mogadishu on Friday in a bid to resolve the elections impasse.

The government had warned the opposition against staging the protest, due to soaring cases of coronavirus in the city. However the opposition vowed to press on.

"Tomorrow marks the onset of... mass protests all over Somalia which will continue until Farmajo steps aside to pave way for free, fair and credible elections," said a statement from the opposition coalition on Thursday.

Map of Somalia's capital Mogadishu
Map of Somalia's capital Mogadishu AFP / STAFF

The group is allied against Farmajo but includes candidates running individually for his job, including two of Somalia's former presidents.

Tensions first erupted overnight, with both sides accusing the other of staging attacks.

The Somali government in a statement accused "armed militiamen" protecting opposition leaders of attacking a government security checkpoint and seeking to take over parts of Mogadishu.

The opposition denied this and accused government forces of attacking the hotel where they were staying.

"They have attacked Maida hotel where myself and former president Hassan Sheikh Mohamud," where staying, said another former president Sharif Sheikh Ahmed on Twitter.

After the fighting overnight, government forces took control of the public square where the protest was to be held, and closed down all roads leading there, stationing military vehicles and troops around the capital.