Troops and armed men exchanged gunfire twice on Sunday in the Somalian capital Mogadishu on the margins of a demonstration by opponents of the president, police said.
The situation remained confused later Sunday with sporadic gunfire heard and troops blocking all major roads.
Several dozen opposition supporters earlier marched in protest against President Mohamed Abdullahi Mohamed, better known as Farmajo, whose legal authority has been in doubt since February when his four-year term expired before fresh presidential elections were held.
"Some clan militiamen organised by opposition politicians tried to disturb peace in Mogadishu, they have advanced onto police checkpoints… but the security forces took immediate action against them," police commander Mohamed Abdirahman said.
"The security forces are now in full control of the situation," he added.
A second exchange occurred later nearby. It was not yet known if there were any casualties.
There was also a confrontation in the area where former President Hassan Sheik Mohamud, another opposition leader, lives.
"It is unfortunate that forces loyal to the president whose mandate expired attacked my house, I have previously warned about politicalising the security and I repeat it. Farmajo will take responsibility for the consequence of these acts," he said on Twitter.
Witnesses denied that his home was attacked, as did the Ministry of Internal Security which in a statement said: "Earlier today, our forces foiled several attempted attacks against the public and shut down the organised militia who entered the capital with an aim of instilling fear and panic among the public."
'Highly concerned'
Later Sunday, sporadic gunfire was heard in the capital although the source was unclear.
Britain's embassy in Mogadishu and the EU's envoy Nicolas Berlanga expressed concern.
"Highly concerned about the ongoing events in Mogadishu," Berlanga said on Twitter.
"The general interest requests maximum restraint, preserve institutions that belong to all and dialogue. Violence is unacceptable. Those responsible will be held accountable."
In April, a bill extending the president's authority by two years bypassed the Senate after being adopted by the lower house of parliament.
Opposition parties condemned the move as an unconstitutional bid to cling to power, and the law was criticised by the international community.
The president and leaders of Somalia's five semi-autonomous federal states had reached an agreement in September that paved the way for indirect parliamentary and presidential elections in late 2020 and early 2021.
But it fell apart as squabbles erupted over how to conduct the vote, and multiple rounds of talks have failed to break the impasse.
On Friday, the African Union condemned the extension of the president's mandate.
The UN Security Council also adopted a statement calling on parties in Somalia "to reject violence and resume dialogue as a matter of urgency and without precondition," underscoring its concern over the country's political crisis.