Tunisia has declared a state of emergency, just over a week after 38 tourists, mainly Britons, died in an attack in the resort city of Sousse.
The state of emergency gives security forces more powers and limits the right of public assembly.
Authorities had already tightened security, deploying more than 1,400 armed officers at hotels and beaches.
Tunisian President Beji Caid Essebsi said in a national address that “exceptional measures” were needed.
“In order to face up to this scourge we need to be prepared. We need to have enough troops, proper training and material means – we are in desperate need of material means,” he said, appealing for international counter-terrorism support and co-operation.
The state of emergency will be in place for a renewable period of 30 days.
An official from the prime minister’s office said several officials had been sacked in the wake of the attack, including the governor of Sousse.
“Just as there have been security failures, there have also been political failures,” Dhafer Neji told AFP.
Security forces were criticised for not responding more quickly to the attack on 26 June in Sousse, when a gunman opened fire on tourists on a beach and in a hotel before being shot dead by police.
Those killed included 30 Britons.
The gunman has been identified as student Seifeddine Rezgui, who authorities say had trained in Libya.
Tunisian Prime Minister Habib Essid conceded in a BBC interview on Friday that the slow response of the police was a key problem.
He said Rezgui had probably trained with the Ansar al-Sharia group, though Islamic State (IS) earlier said it was behind the attack.
Eight people have been arrested on suspicion of collaborating with Rezgui, and the government says it has uncovered the network behind the Sousse attack.
Authorities have also pledged to close some 80 mosques that were operating outside government control and accused of spreading extremism.
Analysts say Tunisia has been put at risk by the chaotic situation in neighbouring Libya, and by the danger posed by Tunisians who have gone to fight in Syria and Iraq returning home.
In his speech on Saturday, Mr Essebsi spoke in general terms about the threat posed by Libya.
He also spoke at length about the economic and social challenges facing the country, including high unemployment and poverty in the country’s interior.
Tunisian security forces had responded to security challenges “gradually”, he said, “because we did not have the culture of terrorism in Tunisia”.
The last time Tunisia declared a state of emergency was in 2011, in the uprising which overthrew President Zine al-Abidine Ben Ali. It was lifted in March 2014.
Officials are expected to pass a counter-terrorism bill that has been in parliament since early 2014 in the coming weeks.
The Sousse attack represented the second blow in three months to Tunisia’s tourism industry, an important sector for the country.
In March, two gunmen killed 22 people at the renowned Bardo museum in Tunisia’s capital, Tunis.