The terrorist attack at Tunisia's Hotel Riu Imperial Marhaba that left 39 people dead was remarkable in its brashness and its detail. Islamic State were quick to name 23-year-old Seifeddine Rezgui as a ‘soldier of the caliphate’ yet on the surface Rezgui appeared to have been a regular young man. He'd never been abroad, let alone to Syria or Iraq. He was a fan of Real Madrid and a former break-dancing enthusiast.
This was the single largest attack on foreign tourists in a North African country since the Luxor massacre in 1997 and many will be asking why it took place in Tunisia, the country hailed as the only success story of the Arab Spring. The country's relative tranquillity allowed it to attract fairly large numbers of tourists, despite its location right next to Libya.
Tunisia has been in better shape politically than many of its neighbours but it is no simple success story. This was the second mass-casualty attack at a Tunisian tourist site this year, after another on the Bardo National Museum in March left 22 people dead. Tunisia is also believed by Western intelligence agencies to be one of the leading sources of jihadist fighters travelling to Syria last year.
Nonetheless the question remains, why would Isis choose a beach in Tunisia for such an attack? In all likelihood the attack was not directed from Raqqa. Instead Rezgui was likely to have been a radicalised sympathiser rather than an agent per se. The authorities are searching for accomplices but the attack was essentially of a lone and lupine nature.
Of course attacks almost anywhere, particularly in a new province closer to Europe, are well within Isis’s general goal of expansion. One of this scale, in a location still seen as a successful democratic state by the West, will have been gleefully welcomed by the group.
While Tunisia may not be as obvious a target as Libya or Egypt, jihadists have been attacking the country's security forces consistently for years, albeit in less visible places than its luxury hotels. In the south, particularly in the Jebel Chaambi region, militants have waged a low-level war against police and military personnel. They have even assassinated two leading opposition politicians in the past two years.
There were recent democratic elections held in Tunisia but serious problems remain. Dictator Zine El Abidine Ben Ali may be gone but the network of corruption and nepotism he built into the economy is not. Unemployment in Tunisia is still around 15 per cent, double that for the young, leaving plenty of dissatisfied young men looking for a cause to join.
Isis and its sympathisers see men like the new president Beji Caid Essebsi and those around him in the ruling Nidaa Tounes party as corrupt tyrants. They attack tourist sites in the knowledge that this will bring the most attention to the area and create panic. Tourism represents a very considerable chunk of Tunisia's economy, around 15 per cent. Terrorist attacks like Friday's are meant to deter tourists and provoke an anti-democratic reaction from the delicate democratic state.
Belgian airline Jetairfly recalled one of its Tunisia-bound planes mid-flight after the attack and thousands of tourists have been evacuated from the country, so the tactic appears to have partly worked already.
Whether the Tunisian government will respond as the attacker would have liked remains to be seen. But with 60 dead in the space of a few months, no one can say the authorities are doing a great job protecting the population and its key industries. Tunisia's modestly successful reforms may be part of the reason the likes of Isis want to strike there. In response, the best course of action would be to continue with the reforms, rather than yield to their desperate attacks.
Tom Stevenson is an independent journalist based in Cairo