Fighting has broken out in the Somali capital, Mogadishu, between different sections of the security forces.
Reports said heavy weapons were used and mortar rounds were fired near the presidential palace.
Some of the military units support President Mohamed Abdullahi Mohamed while others are opposed to him.
Last week Mr Mohamed – known as Farmajo – controversially approved a two-year extension of his term in office. His mandate officially ended in February.
The move was strongly criticised by the international community including the UN and the African Union.
Reports from Mogadishu on Sunday said what started as localised clashes spread to other parts of the city including central areas.
Local media said the fighting was between pro-government forces and military units that support the opposition, but some former warlords and clan leaders are also involved in the clashes.
It was not clear if there were casualties.
Caasimada Online, a privately owned website, said anti-government protesters had taken to the streets, burning tyres, and rebel soldiers had seized control in parts of north Mogadishu.
The protesters reportedly chanted: “We do not want a term extension. We do not want Farmajo. We do not want dictatorship.”
Former Somali president Hassan Sheikh Mohamud and opposition leader Abdirahman Abdishakur said pro-government soldiers had attacked their homes.
In a post on Twitter, Mr Abdishakur said the opposition had “warned against politicising the military”.
Later on Sunday, Somali security minister Hassan Hundubey Jimale accused unnamed foreign countries of being behind the violence.
In a televised statement, he said organised militia groups had been sent to Mogadishu to create chaos, and that security forces had now dealt with them.
“People who do not care for their people and country have organised militias, refused to listen to peace overtures and attacked Mogadishu today,” the minister said. “Security forces ended the militia attack [by force] after attempts to defuse the situation peacefully failed.”
Somalia has been torn by conflict for decades but had been moving towards stability since 2012 when a new internationally backed government was installed.
However, delayed elections following the end of President Mohamed’s mandate in February have thrown the country into renewed chaos. Some international donors have also pulled out, causing a cash crunch for the government.
Somali elections are conducted under a complex indirect system where clan elders select MPs, who in turn choose the president.
But this time there have been regional squabbles over how power is distributed – and a row over a new election commission.
The UN Security Council said on Friday that the political deadlock was diverting attention from serious problems including the pandemic, a locust invasion and Islamist militancy.