Editor's note: Peter Bergen is CNN's national security analyst, a director at the New America Foundation and the author of "Manhunt: The Ten-Year Search for bin Laden -- From 9/11 to Abbottabad."
(CNN) -- It was the first major terrorist attack in history in which the group that mounted the operation used Twitter to announce to the world it was responsible.
The group then quickly tweeted what its rationale was for the attack and also gave operational details of the assault -- all in real time.
On Saturday a group of armed gunmen stormed the upscale Westgate Mall in Nairobi, Kenya, shooting at shoppers and mall staff with automatic weapons, killing at least 61 civilians.
Several hours into the assault a Twitter account used by the Somali terrorist group Al-Shabaab tweeted: "The Mujahideen ('holy warriors') entered Westgate mall today at around noon and they are still inside the mall, fighting the Kenyan kuffar ('infidels') inside their own turf."
It was the first confirmation that the attack was the work of Al-Shabaab, and journalists around the world quickly reported this.
The terrorist group soon provided a tweeted explanation of its motives: "What Kenyans are witnessing at #Westgate is retributive justice for crimes committed by their military." The Kenyan army is part of a larger U.N.-sanctioned peacekeeping operation that has recently been fighting Al-Shabaab with much success, for instance, a year ago expelling the group from one of its last strongholds, the Somali port city of Kismayo.
As the attack on the Nairobi mall unfolded, Al-Shabaab tweeted, "Since our last contact, the Mujahideen inside the mall confirmed to @HSM_Press that they killed over 100 Kenyan kuffar." HSM_Press is the name that Al-Shabaab has used as its Twitter handle.
Crucially, Al-Shabaab then explained in a tweet that the mall attack was going to be a fight to the death in which there would be no negotiations for the lives of the hostages the gunmen had taken: "We'll not negotiate with the Kenyan govt as long as its forces are invading our country, so reap the bitter fruits of your harvest #Westgate." This key aspect of the assault on the mall was then reported around the globe.
A day into the Nairobi assault, Al-Shabaab tweeted that three Americans were involved in the attack. Since 2007 some 40 Americans have traveled to Somalia to fight with Al-Shabaab, including at least three who volunteered to become suicide bombers for the group, so this claim is not implausible and the FBI is looking into it.
Indeed, whoever was live tweeting the Nairobi attack for Al-Shabaab has a command of colloquial English with a sardonic edge that you might pick up somewhere such as London or Minneapolis.
During the massacre, for instance, Al-Shabaab tweeted, "Like it or loathe it! our mujahideen confirmed all executions were point blank range!" The group also wrote, "#Westgate: a 14-hour standoff relayed in 1400 rounds of bullets and 140 characters of vengeance and still ongoing. Good morning Kenya!"
At one point during the mall siege, responding to media speculation that British-born Samantha Lewthwaite -- whom Kenyan authorities suspect of being a financier of jihadist militants in Kenya -- was part of the operation, Al-Shabaab took to Twitter to deny that a woman had any role: "We have an adequate number of young men who are fully committed & we do not employ our sisters in such military operations #Westgate."
(On Thursday, Interpol issued a red notice -- an international wanted alert -- for Lewthwaite.)
According to an authoritative study of Al-Shabaab's use of social media by the London-based International Centre for the Study of Radicalisation and Political Violence, the group has been active on Twitter since December 2011, sending out a steady stream of tweets to at one point more than 15,000 followers that has included a good number of journalists and terrorism analysts.
Al-Shabaab's Twitter account first used the handle @HSMPress, an acronym based on the group's full official name, Harakat Al-Shabaab Al Mujahideen (Movement of the Holy Warrior Youth).
Since then Al-Shabaab has used other Twitter accounts with some slight variations on the same name such as @HSMPRESS1, @HSM_PressOffice, @HSM_PROffice and the current @HSM_PR.
Al-Shabaab seems to change the name of its Twitter account as it gets taken down, likely because the account is in violation of Twitter's terms of service, which explicitly explains that users cannot "publish or post direct, specific threats of violence against others."
It's impossible to tell definitively if all the tweets on Al-Shabaab's purported accounts are really from the group, but the tone and content of the tweets have generally been consistent over the past two years, and information that the group has tweeted about the Nairobi mall attack, such as its responsibility for the assault and its unwillingness to negotiate for the release of hostages, has, unfortunately, proved to be accurate.
An analyst who has tracked Al-Shabaab's Twitter feed carefully is J.M. Berger, the author of a book about Americans fighting overseas for groups such Al-Shabaab titled "Jihad Joe." Berger has filed a number of reports with Twitter that Al-Shabaab is in violation of its terms of service.
Twitter doesn't comment on why it suspends a particular account -- a representative told CNN, "we don't comment on individual Twitter accounts, for security and privacy reasons" -- but clearly Al-Shabaab is egregiously violating those terms of service, and during the Nairobi attack the group had to use five different Twitter handles as its account kept getting taken down, presumably by Twitter employees.
Since Tuesday, Al-Shabaab has tweeted at its newest site and, as of this writing, it had more than 5,000 followers and had tweeted some 40 times.
Berger says that Al-Shabaab militants have also taken to Twitter in recent weeks during other smaller-scale operations: "They have also tweeted bombing attacks on Mogadishu and attempts to assassinate Somalia's president within the last several weeks."
On Wednesday Al-Shabaab posted via Twitter audio of a short speech by its leader Mukhtar Abu Zubayr, crowing over the attacks and congratulating the "holy warriors" who carried out the Nairobi operation. He gloated, "The attack has also glaringly illuminated the sheer vulnerability of the different sections of the Kenyan forces, be they police, intelligence or the military. ... It's a disaster for the Western politicians and their intelligence apparatuses who have miserably failed to save their own citizens. "
Abu Zubayar also goes by the name Ahmed Abdi Godane, and a U.S. official has told CNN the belief is he ordered the Nairobi operation. The fact that on Wednesday Al-Shabaab posted to Twitter a speech by Abu Zubayar taking ownership of the operation would seem to confirm that belief.
In 1974 terrorism analyst Brian Jenkins wrote an influential paper for Rand in which he made a key observation in the then-fledgling field of terrorism studies. "Terrorism is theater," Jenkins wrote, explaining that the real point of a terrorist attack is not the violence that is visited on its victims but the large number of people watching the event that serves to advertise the terrorists' cause.
A decade later British Prime Minister Margaret Thatcher gave a speech in which she made a similar point, declaring that terrorists depend on "the oxygen of publicity."
Nothing had underlined this better than the Munich Olympics in 1972 during which 11 Israeli athletes were taken hostage by Palestinian terrorists. All the Israelis were killed either by the hostage takers or during the course of a botched rescue operation.
The hostage-taking was covered by TV networks from around the world who came to cover the games but ended up providing coverage of a terrorist event that unfolded before the first truly global audience for such an attack. More than any other single event, it brought the Palestinian cause to the world's attention.
On 9/11 untold hundreds of millions around the world watched the attacks as they happened in New York and near Washington on live television. Osama bin Laden himself listened to live coverage of the attacks on BBC Arabic radio in his hideout in Afghanistan.
The 9/11 attacks, which took place in the city that is many ways the capital of global media, thrust bin Laden and his terrorist group al Qaeda onto the world stage in a spectacular manner.
But in neither the Munich Olympics hostage-taking nor on 9/11 did the terrorists have actual control over the content of the coverage, which was instead determined by those media networks covering the event.
So what we saw unfold in the attack on the mall in Kenya is something quite new: a terrorist group shaping the media coverage of the event in real time through the medium of Twitter.
The next logical step will be for terrorists to cover their deadly operations using their own real-time live video feeds linked to sites such as Twitter, Facebook or YouTube.
If that happens, terrorist attacks will become a form of theater in which terrorists not only get to write the play but also act as the primary producers of the coverage of the event.
A dark glimpse of this brave new world could already be seen in Al-Shabaab's assault on the Nairobi mall.
Unfortunately, that may not be the end of Shabaab's terror attacks outside Somalia. On Thursday Shabaab posted the following chilling tweet: "The mesmeric performance by the #Westgate Warriors was undoubtedly gripping, but despair not folks, that was just the première of Act 1."