At least 300 people have been killed in more than 20 attacks that the al-Shabab group has carried out in Kenya in the past five years.

Based in the Horn of Africa, the al-Qaeda-linked group initially concentrated its attacks in Somalia, where it wants to impose a strict version of Islamic law and is fighting to overthrow the Western-backed government.

But since 2011, the armed group has increasingly targeted Kenya.

In 2013, it claimed responsibility for a deadly shopping centre attack in the Kenyan capital, Nairobi, that killed more than 60 people. In April 2015, an assault on a university in the town of Garissa left at least 147 dead.

And this week, dozens of people were killed when five al-Shabab gunmen attacked a hotel complex in Nairobi.

Why is Kenya a target?

In 2011, following a spate of kidnappings in its coastal region, Kenya sent its troops into neighbouring Somalia to target al-Shabab fighters, whom it blamed for the abductions. Al-Shabab denied involvement in the kidnappings.

5972187015001

Kenyan troops, backed by Somali soldiers, pushed al-Shabab out of several towns controlled by the group in southern Somalia.

Al-Shabab then started carrying out deadly attacks in Kenya, saying they were in retaliation for Kenyan troops crossing into Somalia.

"They invaded the Muslim land of Somalia ... it's our duty to take revenge," al-Shabab's spokesperson Sheikh Ali Dheere told Al Jazeera in 2014 after the group killed 28 people in an attack in Mandera, near the Somali border.

The group has also claimed responsibility for attacks in Djibouti and Uganda - two countries whose troops are part of a United Nations-mandated African Union peacekeeping mission in Somalia fighting al-Shabab.

A 2010 twin bombing by the group in Uganda's capital, Kampala, left at least 70 dead. Four years later, a suicide attack at a restaurant in Djibouti killed three people.

Burundi and Ethiopia have also contributed troops to the AU mission in Somalia but have not suffered attacks by the armed group.

Kenya shares a long, porous land border with Somalia. Most of the armed group's attacks happened near this 600km boundary that fighters are able to cross easily.

The communities living in this region have long felt abandoned by the central government in Nairobi, further south.

190115143008990

"I think the reason Kenya is hit more often is because it has greater vulnerabilities - more corruption and unaddressed history of marginalising populations particularly in the northeast and on the coast," Patrick Gathara, a Nairobi-based writer and political cartoonist, told Al Jazeera.

After the collapse of the central government in Somalia, many of al-Shabab's top leaders, including current chief Ahmad Omar, have lived in Kenya.

Several other senior figures, including the man suspected of masterminding the Garissa university attack, Mohamed "Kuno" Dulyadayn, who was killed in a joint raid by Somali and foreign troops, are Kenyan nationals.

And, like many Somalis in Kenya, they had unpleasant experiences at the hands of authorities in Kenya before they joined the armed group.

Kuno has repeatedly spoken of mistreatment family members have suffered in Garissa at the hands of Kenyan security forces. For him and many of the top leaders, it is personal revenge.

Nairobi's significance

Until 2015, Kenya had the biggest economy in the region before it was overtaken by Ethiopia.

Two UN agencies - UN-Habitat and the UN Environment Programme - have their headquarters in the Kenyan capital. Several international companies like General Electric, Nestle, Heineken and Mastercard also have a strong presence in the country.

"Nairobi hosts international high-value targets that the group can target to send a signal to western countries. Countries like Burundi are less strategic but also you will have to cross multiple borders to reach and hence risky," Abullahi Boru, a Horn of Africa security analyst, told Al Jazeera.

Nairobi is also the African city of choice for international media houses to base their operations. Last year, the BBC opened its largest office outside the UK in Nairobi. China's CGTN also has its African headquarters there.

Analysts say the group knows targetting Kenya will bring big media coverage which it can in turn use to bolster its ranks.

"Al-Shabab, like many groups of their ilk, are very well attuned to the reality that a huge media attention generates more recruitment opportunities," said Boru.

Kenyan President Uhuru Kenyatta has promised to bring to justice all those who were behind the Nairobi hotel attack. The announcement might result in tit-for-tat attacks from the armed group.