Police officers control the crowd while surrounding a man  suspected of having been involved in opening fire on a beachside hotel in Sousse, Tunisia, on June 26. (Amine Ben Aziza/Reuters)

Tunisia’s government has been quick to announce steps to prevent more terrorist attacks after the tragic shooting in Sousse on Friday, which left at least 39 tourists dead, many of them Britons. But these plans raise serious questions about the future of Tunisia’s once-hopeful democratic transition.

The shooting on the beach at the Imperial Marhaba Hotel in Port El Kantaoui, on the northern end of the Sousse coastline, was the worst terrorist incident Tunisia has faced. In addition to the cost in human lives, the economic impact is likely to be devastating. Coming just three months after 22 tourists were shot dead in the Bardo museum in Tunis, this attack could mean serious, long-term damage to the important tourism industry, which is worth up to 15 percent of Tunisia’s economy. Thousands of tourists have already flown home and more will follow. The tourism sector has one quarter of all of Tunisia’s bad loans, according to the World Bank. That means the impact will be felt across the wider economy, which is already suffering weak growth and persistent unemployment – officially at 15 percent, but unofficially much higher.

Nidaa Tounes, the political party which swept legislative and presidential elections late last year on a promise of security and prosperity, is still struggling to present a coherent strategy of economic reform and renewed investment. In the past, Nidaa, which has links to the political and economic interests of the former regime of Zine el-Abidine Ben Ali, was constantly critical of its rival, the Islamist movement Ennahdha, which led a coalition government until early 2014. It accused the Islamists of security lapses, including over the assassination of two prominent politicians in 2013, and for the slow pace of economic recovery. Now Nidaa finds itself facing the same criticism.

Prime Minister Habib Essid, a technocrat appointed to lead the cabinet, has announced a security crackdown, promising to tighten policing at tourist resorts, hotels and archaeological sites. Although there were police and national guard checkpoints on the highways leading into Sousse, and along the main coast road running past the beach hotels, security at the individual hotels was very limited. The gunman in Friday’s attack approached from the sea, and it reportedly took 30 minutes before armed police arrived to stop him. Sousse hotels, a prominent destination for cheap package holidays, have been hit twice before: once in 2013, when a failed suicide bomber blew himself up on the beach, and previously in 1987, during a serious confrontation between the Islamist movement and the regime.

Other security measures will follow as the counter-terrorism narrative returns to dominate as it did under the old Ben Ali regime. Essid said 80 mosques will be closed within days. In the wake of the political vacuum that followed the 2011 uprising, Salafi preachers took control of about 1,000 of Tunisia’s 5,000 mosques. Gradually, the state has regained control over nearly all these mosques but precise figures vary. In March, the religious affairs minister said 187 mosques were beyond state control.

In other cases, there are fears of a return to authoritarian tactics. Essid has signaled that he will try to close down at least one small political party, Hizb ut-Tahrir, the Party of Liberation, which has a 30-year history in Tunisia. Although Hizb ut-Tahrir advocates a caliphate under sharia law, in Tunisia it has remained non-violent and was quick to condemn the Sousse shootings. It has not been linked with any of the terror attacks during the past four years. The government will also move against some religious associations and will revise laws on funding for associations. For its part, Ennahdha, although it may privately fear a crackdown, has in public so far sided with the government, calling for a national dialogue on the security crisis and saying that Islam was not to blame. In a speech Saturday, Ennahdha’s leader Rachid Ghannouchi warned against a return to a police state.

New draft laws have also raised concerns, even as the judiciary, security services and much of the deep state remains unreformed since the uprising. One new bill proposes jail terms for any Tunisian found to have “denigrated” police and security services. Another draft law on judicial reform has been found to be unconstitutional for failing to guarantee sufficient independence for judges. The long-awaited counter-terrorism bill, which the government now promises will be completed within a month, has also been criticized by human rights groups as flawed.

Often, politicians, including President Beji Caid Essebsi, the Nidaa founder and a former interior minister in the 1960s, have blamed violent extremism on foreign groups or funding. While the chaotic situation across the border in Libya has allowed Tunisia militants room to train and arm themselves, it is also clear that jihadi violence has been a Tunisian problem for many years, even before 2011. The men responsible for the Sousse shootings and the Bardo attack in March were all young Tunisians. Sousse itself is not just a tourist resort: It too has produced its share of radical extremists who were involved in attacks inside Tunisia and who have traveled abroad to fight in Iraq and Syria with Islamic State. The gunman in Friday’s attack, a 23-year-old student at university in Kairouan, may have been inspired by Islamic State as the group claims, but violent extremism is a Tunisian problem as much as it is a foreign creation.

The security crisis comes on top of significant social and economic unrest. Strikes, sit-ins and demonstrations have intensified in recent months. Work has been halted for several weeks at the main phosphate mines around Gafsa in the south because of disputes over hiring practices, working conditions and pay. The social affairs ministry reported 106 strikes in the first half of the year; the Nidaa-led government has told strikers to get back to work.

Other demonstrations have spread as part of the Where Is the Oil? movement (“Winou el pétrole?”), gathering thousands of protesters to campaign for greater transparency over the nation’s modest petroleum resources. Protests have often led to violent clashes with the police. Though Essebsi dismissed the movement as “unpatriotic” it shows a growing popular distrust of elite-level politics and worsening frustration at the lack of social and economic reforms.

For many Tunisians, especially in the poor south and interior regions, the original goals of the revolution – work, freedom and national dignity – remain unmet. Some already caution against reading the Tunisian transition as a model story of unqualified success. Although Tunisian political leaders have negotiated their way out of many crises in the past four years, it will be increasingly difficult to keep their democratic transition on track.

Rory McCarthy is a doctoral candidate in oriental studies at the University of Oxford and a former Middle East correspondent for the Guardian.