Gunfire erupted across the Somali capital, Mogadishu, on Sunday as security forces loyal to the president clashed with units that appeared to have sided with his rivals, stoking fears that Somalia’s simmering political crisis is spilling over into violence.
The fighting, some of the worst in the Somali capital for years, followed months of tense talks between President Mohamed Abdullahi Mohamed and opponents who accuse him of making an unconstitutional power grab.
The talks collapsed after Mr. Mohamed failed to hold presidential and parliamentary elections by February, as scheduled, and then two months later signed a law extending his term in office by two years. His actions have drawn criticism from the United States and other Western allies.
The moves effectively ended United Nations-mediated negotiations backed by the United States and added fuel to an already combustible political situation.
The shooting started Sunday afternoon after soldiers aligned with the opposition took positions at several strategic locations in Mogadishu, drawing fire from pro-government forces. Analysts said the rift was influenced by the powerful clan divisions that have often been at the center of the turmoil Somalia has faced since its central government collapsed in 1991.
As rival factions traded fire late into Sunday evening, alarmed Western officials appealed for a halt to fighting they feared might spiral into a wider confrontation that could unravel years of modest yet steady progress toward turning Somalia into a functioning state.
The European Union ambassador to Somalia, Nicolas Berlanga, appealed on Twitter for “maximum restraint” on all sides. “Violence is unacceptable,” he said. “Those responsible will be held accountable.”
The fighting also raised the possibility of dangerous fissures along clan lines inside the Somali military, and the worry that powerful foreign-trained units, including an elite American-funded commando squad, could get sucked in.
Videos posted online by Somali reporters and news outlets Sunday night depicted long bursts of gunfire around Kilometer 4, a major junction in the city. Some of fighting occurred near Villa Somalia, as the presidential palace is known.
Foreigners living in the highly protected zone around Mogadishu’s international airport said they had retreated into bunkers to avoid being hit by stray gunfire.
The main clashes occurred outside the homes of Hassan Sheikh Mohamud, a former president of Somalia, and Abdirahman Abdishakur Warsame, the leader of a major opposition party. In statements, both men laid blame for the attacks on President Mohamed, who is popularly known by the nickname “Formaajo.”
At a hastily convened news conference, Hassan Hundubey Jimale, Somalia’s minister of internal security, denied that the government had attacked the former president’s home and blamed unspecified foreign countries for the clashes.
Mr. Jimale gave no details about how many people had been killed or injured.
Critics said Mr. Mohamed was making a high-stakes bid to stay in power.
“It seems Formaajo has decided his final suicidal attack by attacking every opposition figure in town,” said Hussein Sheikh Ali, a former national security adviser who once worked under Mr. Mohamed.