Tunisian President Beji Caid Essebsi declared a state of emergency on Saturday, saying the Islamist militant attack on a beach hotel that killed 38 foreigners had left the country "in a state of war".
Last week's attack, three months after the deadly Islamist assault on the Bardo museum in Tunis, has shocked the North African country emerging into a democracy following its 2011 "Arab Spring" uprising.
Tunisia's emergency laws temporarily give the government more executive flexibility, hand the army and police more authority, and restrict certain rights such as those dealing with public assembly and detention.
"Due to the terrorism risk, and the regional context, and spread of terrorism, we have declared a state of emergency," Essebsi said in a televised address.
"The continued threat we face leaves the country in a state of war, where we have to use all measures necessary."
A Tunisian gunman, said to have been trained in a jihadist camp across the border in Libya, opened fire killing foreign tourists, mostly Britons, in the resort of Sousse on June 26.
The beach massacre struck a huge blow to Tunisia's tourism industry, prompting thousands of holidaymakers to leave and causing an estimated $500 million in losses for a sector that makes up seven percent of the economy.
Authorities have moved to close down 80 mosques they said were operating illegally or spreading extremism which officials say helps recruit young Tunisians to Islamist militancy.
Tunisia last had a state of emergency during the 2011 uprising against autocrat Zine el-Abidine Ben Ali. That revolt followed years of upheaval between secular and Islamist parties in one of the Arab world's most secular countries.
Tunisia has since been hailed as a model of peaceful democratic transition in the region. But it has also struggled with the rise of Islamist movements, some opposed to democracy and bent on violence.
More than 3,000 Tunisians have left to fight overseas in Iraq, Syria and Libya for Islamic State or other militant groups. Some have threatened to return home to carry out attacks in Tunisia.
Tunisian authorities believe militant group Ansar al-Sharia is responsible for orchestrating the attack on the Imperial Marhaba hotel. The gunman, Saif Rezgui, a young student, gave little clues to his radicalisation before he attacked.
"For the moment, this was Ansar al-Sharia who were behind this," said the Tunisian security source.
Islamic State militants have claimed responsibility for the hotel massacre. Islamic State also claimed the Bardo attack, but authorities linked that attack to the local Okba Ibn Nafaa brigade.
Tunisian officials say all three gunmen in the two attacks were trained at the same time in jihadist camps over the border in Libya, where factional turmoil has allowed Islamist militant groups to gain ground.
Ansar al-Sharia and Okba Ibn Nafaa are tied to the al Qaeda franchise. But experts say that, as in other regions, younger fighters and recruits may be breaking away from those groups, inspired more by the recent victories and propaganda of Islamic State.
Date created : 2015-07-04