Just three months after an attack on the National Bardo Museum, Tunisia is reeling from an even deadlier attack on tourists, raising questions about its ability to counter the jihadist threat.
Friday's assault by a Tunisian student at a popular resort at Port El Kantaoui that killed 38 people illustrates the complexity of the challenges ahead for Tunisia four years after its revolution.
Saturday's local press highlighted the concern that many feel.
"While we saw this coming, we were unable to stop tragedy from striking again after the Bardo, right under our noses, despite the entire security apparatus... being on the lookout for signs of a new catastrophe," wrote the French-language daily Le Temps.
After Friday's attack, Prime Minister Habib Essid announced an "exceptional plan to better secure tourist and archaeological sites".
But after the March 18 attack on the Bardo in the capital, the authorities had already admitted there were faults in the security system, and then too they announced new measures.
On Friday, Essid said the government would close 80 mosques suspected of fanning Islamist extremism.
Again, plans to close "illegal" mosques that flourished in the aftermath of the 2011 revolt were also announced by the former government -- without much success.
The authorities announced a crackdown on such mosques in March 2014, and in July last year officials vowed to close mosques where the killing of 15 Tunisian soldiers had been celebrated.
Hamza Meddeb of the Carnegie Middle East Center says cracking down on fringe mosques alone will not work.
"A real reform of the religious camp is needed, so that a discourse capable of countering that of the radical groups emerges," Meddeb told AFP.
"We do not fight these groups... by creating a vacuum in the religious camp."
Ousted dictator Zine El Abidine Ben Ali's intolerance of religious groups "resulted in the radicalisation of a large section of the youth" after the turn of the century.
Following Friday's attack, social media users reposted recent jihadist threats against Tunisia, underlining that there had been plenty of signs of the violence to come in a country that has become one of the world's top exporters of jihadists.
Some 3,000 Tunisians have left to join extremists in war-torn Syria, Iraq and Libya.
Meddeb believes the authorities "have not done, and are still not doing enough to protect either the population or tourists", even though it is hard to imagine how they alone could guard Tunisia's long coastline.
Friday's attack was carried out by an Islamist who concealed a Kalashnikov assault rifle inside a parasol. He was shot dead only after he had killed dozens of beach-goers.
Some witnesses said it took the security forces around 30 minutes to respond to the incident.
However, experts say it is difficult, if not impossible, to completely prevent such shock attacks.
Secretary of State for Security Rafik Chelly called it an "isolated" act.
Zohra Driss, who owns the Riu Imperial Marhaba Hotel north of Sousse that was targeted, told reporters on Saturday: "At the hotel we have five or six guards on the beach, but they are not armed.
"How do you want them to... defend themselves against someone with a Kalashnikov?"
Lina Khatib, director of the Carnegie Middle East Center, told AFP that no country is "immune from terrorism".
But Tunisia "needs to seriously engage in reform of its security sector in order to restore citizens' trust in the police", she added.
The country's police force is regularly accused of failing to abandon the methods it was notorious for under Ben Ali, fuelling widespread mistrust among the population.
On Friday, after Essid announced that citizens who help arrest "terrorist elements" would be rewarded, some critics branded the move as encouraging denunciation.