Last week, militants armed with guns and explosives stormed the Dusit2D hotel and surrounding shopping complex at 14 Riverside in Kenya’s capital of Nairobi, resulting in the deaths of at least 21 people, including an American and a British citizen.

The attack has quickly focused attention on the continued risk posed by terrorist groups like al-Shabab, who claimed responsibility for the attack. They released a statement saying the attack was a response to US President Donald Trump’s decision to recognize Jerusalem as the capital of Israel.

In the past decade, al-Shabab has plotted some of the deadliest attacks in East Africa, including a 2013 attack on the Westgate shopping mall in Nairobi, Kenya, that killed 71 people, and a massacre at Kenya’s Garissa University in 2015, that killed 148 people.

After last week’s nearly 20-hour siege against the attackers came to an end, Kenya’s President Uhuru Kenyatta vowed to swiftly bring the culprits to justice, and make the country “inhospitable to terrorist groups and networks.”

Billions of dollars have been spent on the peace enforcement and counterterrorism efforts of the African Union Mission in Somalia and US Africa Command, and an American drone program that has expanded under US President Donald Trump. Yet, quelling extremist groups like al-Shabab have proven elusive.

Related: Inside America's shadow war against al-Shabab

Al-Shabab’s main goal has been to establish an Islamic government in Somalia. It is also an affiliate of al-Qaeda who supports an agenda of global jihadism, according to Harun Maruf, a journalist at Voice of America and co-author of “Inside al-Shabaab: The Secret History of Al-Qaeda’s Most Powerful Ally.”

But analysts say extremism is on the rise in East Africa because the group has also been able to exploit local grievances, attracting impoverished recruits across faiths in Kenya who feel the government has failed them.

Family members reunite outside the Dusit hotel complex on Jan, 16, 2019. Gunshots continued to be heard throughout the night and people were still trapped inside throughout the morning. The attack was claimed by al-Shabab, a militant extremist group. Credit: Halima Gikandi/The World

Al-Shabab from within

Most of al-Shabab’s activities are focused within Somalia’s borders, where they jockey with an emerging, pro-ISIS group to extort taxes from businesses. The extortion, often exploiting the Islamic principle of zakat or "charity," allows al-Shabab to circumvent crushing international sanctions and secure millions of dollars in revenue, while also demonstrating their ability to administer over new swaths of territory using a strict interpretation of Islam.

They have also staged deadly attacks against military and civilian targets in recent years.

According to Maruf, al-Shabab emerged in 2006, when US-backed Ethiopian forces invaded Somalia in an effort to support the federal government, destroying their political rival, the Islamic Courts Union (ICU), in the process. The ICU had become increasingly powerful, and popular, by promoting an Islamist interpretation of law and governance.

Since ICU’s defeat, al-Shabab has been able to draw local sympathy by appealing to the distrust of ordinary Somalis toward foreign intervention and a desire among some to bring back the Islamic Courts.

“There are people who really believe that Somalia is under attack by foreign powers,” Maruf said.

Related: Al-Shabab kidnaps Somali children to fill its ranks. Parents pull kids from school or flee to protect them.

This month, the Somali government expelled a UN envoy, accusing him of interfering in a regional election that occurred in December, in which a former al-Shabab leader was running for office.

Following the expulsion, Somalia’s ambassador to the United Nations, Abukar Dahir Osman, said that his countrymen wanted “Somalia leading international support, not international support leading Somalia.”

At the same time, the group leverages local anxieties about threats to Somalia’s sovereignty to defend their attacks abroad and attach them to a global jihadi response to perceived attacks on Islam.

“They appeal to a lot of Somalis who support them because they believe that al-Shabab wants to establish an Islamic government in Somalia,” Maruf explained.

For years, al-Shabab has benefited from tapping into the grievances and anxieties in which they arose. Now, they are employing foreign recruiters to do the same.

Newspaper read by locals in the Eastleigh neighborhood of Nairobi on Jan. 18, 2019. In Kenya, rumors about the identity of the Dusit2D Hotel attackers swirled in the days after the attacks. Credit: Halima Gikandi/The World

Regional expansion of new recruitment efforts

Al-Shabab’s recruiting outside of Somalia is not new. For the past decade, they have strategically targeted poor communities along East Africa’s Swahili coast who share historical connections through Islamic culture and ancient trade roots.

Despite efforts by the Kenya government to counter extremist ideology by reaching out to community and religious leaders, al-Shabab recruitment has exploded, and their strategy is shifting, said Rashid Abdi, the Horn of Africa Project Director at the International Crisis Group.

In 2018, the US government designated the Nairobi-based extremist group al-Hijra as an official arm of al-Shabab, due to their central role in facilitating the recruitment and travel of supporters in Kenya. The group’s Kenyan leader, Ahmad Imam Ali, has been known to focus his recruitment efforts in poor areas in Nairobi, like the Majengo slums.

“They are also converting Christians and recruiting from central Kenya, western Kenya, and parts of Uganda.” Rashid Abdi, Horn of Africa Project Director at the International Crisis Group

Ali is on a US sanctions list, and there's a $3 million US bounty on his head.

“They are also going beyond traditional Muslim communities,” Abdi said. “They are also converting Christians and recruiting from central Kenya, western Kenya, and parts of Uganda.”

Abdi said that the group’s successful recruitment lies in part by exploiting local grievances of young people, who face extremely high levels of poverty and unemployment.

Maruf estimates there are currently 13,000 people fighting for al-Shabab — 700 of them are recruits from East Africa, mostly Kenyans based at the Somali-Kenyan border.

Africa is the world’s youngest continent, and 50 percent of East Africa’s population is under the age of 20. Despite being an increasingly technical and digitally connected demographic, young Africans have few job prospects. In Kenya, 20 percent of young people aged 15 to 24 are unemployed, and many are working with insecurity in the informal sector.

Related: Somalis walk for days searching for food and water while al-Shabab blocks aid

In the days following the attacks, local news media reported that two of the suspects were Kenyans from poor communities in Nyeri and Kiambu counties, which are predominantly Christian areas of central Kenya. Reports suggest they were recent converts to Islam. Details are still emerging about the identities of eight suspects arrested for the attack, but their names suggest they were of Kenyan, not Somali, background.

“The communities were already feeling marginalized before al-Shabab,” Abdi said. “So, these kinds of grievances feed into al-Shabab’s line that Kenya is sidelining them.”

Last Wednesday, the hashtag #StopRadicalization began trending on Twitter, as Kenyans called for the government to offer more opportunities for young people.

Erick Mutisya, 22, works as a street hawker in the Eastleigh neighborhood of Nairobi, which is sometimes called "Little Mogadishu" because of the high number of Somali refugees and immigrants. As a Christian, he condemned the recent attacks, but could also understand why young people were turning to extremism.

“Kenya has high rates of unemployment,” he said, perched on top of a guard rail during a demonstration by Somali business owners against the recent terror attacks. He is married, expecting a child, and has trouble finding enough work to sustain them both. “That is the story behind these terror attacks.”

"Kenya has high rates of unemployment. That is the story behind these terror attacks." Erick Mutisya, street hawker, Nairobi

Recruiting foreigners from the region is a practical solution, said Abdi, who sees al-Shabab trying to replenish their forces. US-led drone strikes killed more than 300 al-Shabab militants in Somalia in 2018. Foreign al-Shabab recruits might also receive less scrutiny from Somali authorities and travel in and out of Somalia more easily without detection.

“If you look at the arrests in recent years, clearly some of the leading, most highly radicalized individuals who are playing a leadership role in the organization and leading recruitment efforts, are actually converts,” Abdi said.

Women walk down the streets of Eastleigh neighborhood of Nairobi, Kenya, Jan. 19, 2019. The neighborhood is currently under quarantine due to a spike in coronavirus cases. Credit: Halima Gikandi/The World

Extremism and radicalization growing in unexpected places

Analysts are worried that extremism will continue to grow in East Africa until governments are able to address the underlying local issues pushing people to it in the first place.

Reports of extremism continue to dwell deeper into the East African interior, toward the Great Lakes region, and further down the Swahili coast.

According to a 2018 report by the International Crisis Group, al-Shabab has started forming relationships with militant leaders in southern Tanzania and northern Mozambique, where reports of an emerging violent militia waging terror against villagers has concerned the government enough to restrict journalists from covering it.

The predominantly Muslim area of northern Mozambique could become the fourth-largest exporter of natural gas and holds about 40 percent of the world’s rubies. But most residents live under the poverty line and have faced state violence.

Villagers living in the areas where the attacks have occurred sometimes refer to the nascent group as “al-Shabab,” but Abdi stresses that there is no evidence that the group is linked to the Somali al-Qaeda affiliate.

Still, he says that the familiar combination of poverty and unemployment are conditions that could once again be exploited by regional extremist groups like al-Shabab.

Related: Minnesota's Somali immigrants feel 'holes' left after deadly Mogadishu attack

“There is no doubt that there is a jihadist problem in East Africa,” Abdi said.

Unless the government acts to address these underlying grievances, the opportunity of exploitation will continue to grow, and the threat extremism poses to cities like Nairobi will continue.

Halima Gikandi reported from Nairobi, Kenya.