JOHANNESBURG – The Islamic extremists of al-Shabab, who claimed responsibility for the Nairobi shopping mall massacre, have gone through a deadly power struggle within their ranks in which at least two leaders were assassinated in Somalia.

Because of that internal discord, analysts say, the al-Qaida-linked group is now led by hard-liners who are dedicated to global jihad and are putting the region on notice that it could see other similarly spectacular violence.

“It shows that al-Shabab is not an ethnic organization, but an ideologically driven outfit and branch of al-Qaida in the Horn of Africa,” said Abdirasjid Hashi, deputy director of the Heritage Initiative for Policy Studies, a think tank in Mogadishu, Somalia.

Kenya’s president proclaimed victory Tuesday over the murderous terrorists who stormed the Nairobi mall, saying security forces had “ashamed and defeated our attackers” following a bloody four-day siege in which dozens of civilians were killed.

President Uhuru Kenyatta said the dead included 61 civilians whose bodies have been recovered so far and six security officers, while about 175 people were wounded, including 62 who remain hospitalized.

Three floors of the mall collapsed, and several bodies were trapped in the rubble, Kenyatta said. His office later said a terrorist’s body was among those in the debris. Five other extremists were killed by gunfire and an additional 11 suspects have been arrested, he said; authorities had previously announced the arrest of seven suspects at the airport and three elsewhere.

“These cowards will meet justice, as well their accomplices and patrons, wherever they are,” Kenyatta said, in a televised address to the nation.

Kenyatta said that “initial reports had suggested that a British woman and two or three American citizens may have been involved in the attack” but that “we cannot confirm the details at the moment.”

The attack on the Westgate mall in Nairobi counters a narrative that al-Shabab has been on the wane since U.N.-backed African peacekeepers had pushed them out of Mogadishu and major towns in the country since 2011.

“This attack allows the group to reinstate itself as a force to be reckoned with … and offset reports that the group no longer is relevant,” said Natznet Tesfay, head of the Africa country risk team for the IHS business intelligence group.

She suggested that the Westgate assault was timed to coincide with the U.N. General Assembly meeting that began Monday, putting the group at the top of any agenda on African security.

Patrick Smith, editor of Africa Confidential newsletter, called the mall attack “very al-Qaida-esque” and likened it to the 2008 assaults on luxury hotels in Mumbai, India, “sending the message to the rich, the elite, the diplomats that ‘You’re never safe, we can get to you.’ ”

Tesfay said al-Shabab had launched a campaign to maintain its relevance and credibility following the internal power struggle, which culminated in June with gunbattles in the streets of the southern Somali town of Barawe.

It was fueled, in part, by ideological differences between those who oppose any international intervention in Somalia and want the focus to remain on that internal battle, and those jihadists who believe in a wider conflict linked to al-Qaida’s more global agenda.

Somalia has not had a functional government since 1991, when clan warlords overthrew a socialist dictator then turned on each other. Al-Shabab was established in 2006 and became Somalia’s most dangerous militant group, attracting fighters from other countries and carrying out suicide attacks.

It began losing support after a 2011 decision to ban foreign aid organizations from operating in Somalia, leaving millions to suffer in a conflict-induced famine in the country with the world’s highest child-mortality rate. Tensions also grew between Somali fighters and the hundreds of foreign militants drawn to the impoverished nation.

Four top al-Shabab commanders were killed in June, including two co-founders of the group, while its spiritual guide, Hassan Dahir Aweys, fled for his life and was captured by Somali forces who have imprisoned him in Mogadishu.

The infighting persists. This month, an American who joined al-Shabab, Alabama native Omar Hammami, was ambushed and killed by rivals in southern Somalia. Hammami had used social network sites to accuse al-Shabab leader Ahmed Abdi Godane of being a dictator. He had been on the run since the June assassinations.