Tunisia museum attack
A tourist injured after an attack by gunmen on Tunisia's national museum is wheeled on a stretcher in TunisReuters

Following the attacks on Tunis's Bardo museum that killed 21 people on 18 March, Islamic State (Isis)-linked accounts on social media were flooded with messages of glee and triumph, supporters pouring forth messages of jubilation at the massacre of so many foreign tourists. Before long, IS had claimed responsibility for the atrocity.

The attack certainly didn't come out of nowhere. It came after various releases in recent months by IS and its supporters, aimed at recruiting Tunisians and inciting attacks. IS officials, supporters and fighters have been urging for an attack in Tunisia in the group's name for a while now.

On 15 March, IS released a video of a fighter in Raqqa providing advice to fighters in Boko Haram and then stated Tunisian jihadists should follow in the group's footsteps. The message said:

Here, let me not to forget to urge our brothers in Tunisia, saying to them: O my brothers in Allah, O brothers in religion and doctrine in Tunisia, what are you waiting for? What are you waiting for while your brothers are racing one another every day and announcing their pledge to this blessed State? You shall announce it loud and join your brothers.

On the same day, jihadi media group Afriqiyah Media responded with a message attributed to Jund al-Khilafah in Tunisia, the same alleged group attributed to a December 2014 audio recording of a pledge to IS leader Abu Bakr al-Baghdadi. The 15 March message stated in part:

Wait for the glad tidings of what will bring you joy and bring joy to the Muslims in general, soon.

The next day, Afriqiyah Media released a statement that Tunisian rapper "Emino" (AKA Marwen Duiri) had joined IS in a message released on Twitter. The statement claimed:

No one forced him to do this, and no one brainwashed him, as the foolish claim. He did not let the hypocrites and disbelievers tamper with his mind and distort his doctrine. By himself he searched the same as hundreds of thousands of mankind, then he discovered the truth and held to it.

Tunisian rapper
Tunisian rapper EminoSITE

The message also stated:

He became ascetic with celebrity and money, and he chose the path of the strangers. He left the paradise of the disbelievers and sought the paradise of the righteous Muslims.

On the eve of the Bardo museum attack, one social media account appeared to presage the massacre. Its author tweeted in Arabic:

Allah permitting, there will be earthshaking surprises in Tunisia, Egypt, and Libya during these days....

We are coming O Rome

The user also included a hashtag translating to "#Invasion_ofTunisia" in the message, which was tweeted nearly 6,000 times in the first few hours of its creation.

Another IS-linked account tweeted:

From Tikrit to Tunisia to Copenhagen
You will not be enjoying the security unless you pay the Jizyah [religious tax] and get out of our lands from mountains of China throughout Andalusia.

Accounts of IS fighters and supporters have also begun disseminating a December 2014 video urging Tunisian Muslims to pledge to Baghdadi and perform attacks.

Entitled "A Message to the People of Tunisia", the video called for Muslims to "revive the tradition of assassination in Tunisia" and invoked Kamel al-Gathgathi and Lutfi al-Zayn, the killers of Tunisian politicians Chokri Belaid and Mohamed Brahmi.

Rita Katz is executive director of the SITE intelligence group (www.siteintelgroup.com). She has been monitoring terrorist activity and Jihad for more than a decade.

You can find her on Twitter @rita_katz.