Counterterrorism officials often warned another big attack was coming in Kenya’s capital, 15 years since Al Qaeda made its terrorism debut.

A shopping trolley is used to carry away the body of a child killed in a shootout between Al Shabab terrorists and Kenyan police at the Westgate mall in Nairobi. As of late Saturday, there were at least 39 killed, two of them Canadians.

For years there were threats from Al Qaeda’s East Africa group that they would strike and warnings that Nairobi was vulnerable.

Although 15 years have passed since Al Qaeda made its terrorism debut by bombing the U.S. Embassy in Nairobi, the memories remain fresh and counterterrorism officials often said “it’s not if, but when” Kenya’s capital would again be hit.

It is still too early to determine entirely what took place during those terrifying hours inside Nairobi’s Westgate Mall, as gunmen wielding AK47s shot indiscriminately, forcing hundreds to flee.

Al Shabab, the Somali-based group that merged with Al Qaeda last year, claimed credit late Saturday, writing on their Twitter feed: “The attack at #WestgateMall is just a very tiny fraction of what Muslims in Somalia experience at the hands of Kenyan invaders.”

“For long we have waged war against the Kenyans in our land, now it’s time to shift the battleground and take the war to their land.”

They called the Westgate attack “retributive justice” and boasted of killing more than 100, though their claims are typically exaggerated.

Late Saturday, Kenyan President Uhuru Kenyatta told reporters that 39 people had been killed — some whom he described as “very close family members” — and more than 150 were injured. Two of the dead were Canadians.

Al Shabab is one of the more savvy Al Qaeda groups when it comes to social media. Twitter has shut down existing accounts only to have new ones created days later — with the Shabab emailing journalists to alert them of the new name.

On Saturday, Twitter shut down its account again four hours after the extremist group first began writing about the attack. But just a couple hours later, another email to journalists alerted us they were tweeting again under a new name.

The Shabab has continually threatened to attack Kenya since the group formed in Somalia in late 2006. But Kenya — especially the border region between the countries where the Shabab would move goods and fighters into Somalia — remains a crucial locale for the organization, and analysts doubted whether Shabab would risk the backlash should its fighters attack.

Kenya’s military might, coupled with a Somali population weary of war and bitter with how the Shabab contributed to the famine of 2011 by blocking outside food aid, greatly diminished the Shabab’s power.

But this also pushed much of the war next door into Kenya, where Shabab fighters sought refuge. UN Security Council reports on Somalia have been warning since 2011 about the rise of the Kenya-based Muslim Youth Centre and the influence of local sympathizers based in the coastal town of Mombasa.

Nairobi’s Westgate Mall — packed on Saturday during the lunch hour — is often cited as one of the main targets: the upscale mall is popular with foreigners, tourists and wealthy Kenyans.

The mall, which sprawls over 350,000 square feet, is an oasis of calm in the chaotic capital. Shoppers must pass by armed guards and through metal detectors before entering.

During times of heightened alert, foreign embassies often warn their staff to avoid the Westgate Mall and other shopping centres popular with Westerns.

But the warnings have been coming for so long, and life goes on.

While the Shabab is one of Al Qaeda’s most experienced groups, it has rarely launched major attacks outside Somalia, with the exception of the July 2010 assault in Uganda that killed 70.

The Westgate attack continued into the night Saturday, with police and soldiers surrounding the mall. Ten hours after it began, the Shabab claimed through their Twitter feed that they were in contact with their remaining fighters inside.

They wrote: “There will be no negotiations whatsoever.”

Michelle Shephard is the Star’s national security correspondent and author of Decade of Fear: Reporting from Terrorism Grey Zone. She has reported extensively from Kenya and Somalia since 2006.