Islamic State (IS) has said it was behind the deadly attack in the Tunisian resort town of Sousse, in which a gunman killed at least 38 people.
It identified the attacker by the nom de guerre of Abu Yahya al-Qayrawani, with Tunisian authorities naming him as Seifeddine Rezgui, a student not previously known to them.
IS will certainly be the prime suspect, although it is not the only militant threat to the North African country.
This is also not the first time the country has come under attack. It has seen a rise in Islamist militancy since the overthrow of long-serving leader Zine al-Abidine Ben Ali in a popular uprising in 2011.
Six months ago, Islamic State said it was behind an attack on the famous Bardo museum in the capital, Tunis - the first by the group in Tunisia.
Most of the 23 victims were foreign tourists, including British, Japanese, French and Italian nationals.
IS is active in neighbouring Libya, where it has carried out high-profile attacks, including the beheading of Egyptian Coptic Christians living there.
Most IS commanders in Libya are believed to be Tunisians.
Tunisia has contributed the largest number of foreign fighters to IS in Syria and Iraq, according to some researchers. Authorities in Tunis say up to 3,000 Tunisians have gone abroad to wage jihad in the Middle East.
However, Tunisia has also long been involved in a battle with fighters linked to al-Qaeda in the Islamic Maghreb (AQIM) along its border with Algeria.
In July 2014, the group killed 14 soldiers in a raid on two checkpoints in Tunisia's mountainous region.
Within Tunisia itself, the main Islamist group is Ansar al-Sharia. Designated a terrorist group, it was accused of attacking the US embassy in Tunis in September 2012.
It denies that it is linked to al-Qaeda.
In April 2002, the main al-Qaeda network carried out a suicide attack at a Tunisian synagogue, in which 19 people died.
The latest attack shows that the government's efforts to contain the threat of Islamist militants are not yielding the desired results.
The targets in Sousse were western tourists and the state itself. Tourism is Tunisia's largest source of foreign currency and analysts say the government can't afford a collapse of the sector.
It is also a setback to a country once regarded as a beacon of secularism in the Arab world.