Tunisia's Prime Minister Habib Essid has announced a clampdown on security after an attack on a holiday resort in which 38 people were killed.
He said army reservists would be deployed to archaeological sites and resorts.
About 80 mosques accused of "spreading venom" will close within a week, he said.
Fifteen of the victims in Friday's attack near Sousse were Britons. The gunman was shot dead.
He was identified as Seifeddine Rezgui, a student not previously known to authorities, officials said.
One Belgian and one German have so far been identified among the dead, the health ministry said. One citizen of the Irish Republic is also confirmed dead.
There were also thought to be Tunisians and French killed in the attack, which was claimed by Islamic State (IS). At least 36 people are injured, some seriously.
It was the second major attack on tourists in Tunisia since March, when militants killed 22 people, mainly foreigners, at Bardo museum in Tunis.
Many of the tourists in hotels affected by Friday's attack have left the country or are waiting for specially arranged flights, but correspondents noted a few were back by the hotel pool on Saturday, vowing they would continue their holidays as scheduled.
Speaking at a news conference in Tunis, Mr Essid said some mosques outside government control were spreading "venom" and would be shut down.
Mr Essid also vowed to act against parties and groups "acting outside the constitution".
"The country is under threat; the government is under threat," Mr Essid said.
At the scene: Mark Lowen, BBC News, Sousse
The clinics of Sousse aren't used to dealing with gunshot wounds. A quiet, tourist town, it's been severely shaken by this tragedy.
At the Sahloul University hospital, they're taking in the victims. More than 20 are being treated here. One is in intensive care, others are waiting for operations on limbs punctured by bullets.
Tony Callaghan, from Norfolk in eastern England, was at the Imperial Hotel with his wife - it was their third time there. The attack sent him running from the beach into the hotel, crying out for his wife to take cover. One bullet hit his knee. He ended up with a group in one room, barricading themselves in. He could hear his wife outside crying for help. Welling up with tears, he tells me he didn't know if he'd see her alive.
But then he holds up her bag, with her glasses case inside. Both bear bullet holes, the lens of the glasses shattered. The bag took the impact of the bullet which then hit her leg. And she too waits, being treated upstairs at the Sahloul hospital, not knowing when she and her husband will get home.
"Without the co-operation of everyone and a show of unity, we cannot win this war."
However, many Tunisians are asking why stricter security measures had not already been put in place following March's attack, says the BBC's Jim Muir in Tunis.
Security officials said the attacker, who posed as a swimmer but was carrying a rifle under a parasol, started shooting on the beach before entering the Hotel Imperial Marhaba, continuing to shoot.
A British holidaymaker, Steve Johnson, told the BBC: "We were just lying on the beach as usual and... we heard what we thought at first was fireworks.
"But it was soon pretty obvious... that it was firearms that were being discharged and people were screaming and starting to run."
Another holidaymaker, named only as Danny, said he and his wife had sought refuge in an office when the shooting started.
"We hid in there for about forty-five minutes to an hour, I think," he told the BBC.
"We could hear guns and grenades and explosions and all sorts of things...
"I hid under a table and kissed my wife goodbye thinking that that was going to be the end."
IS said it was behind Friday's attack on what it called a "den of vice".
It identified the gunman by the nom de guerre of Abu Yahya al-Qayrawani. Social media accounts close to the group showed pictures of him.
'He took a bullet for me'
One survivor told how her fiance, a Welsh tourist, was shot three times as he used his body as a shield to protect her.
"He took a bullet for me," said Saera Wilson. "I owe him my life because he threw himself in front of me when the shooting started.
"It was the bravest thing I've ever known. But I just had to leave him under the sunbed because the shooting just kept on coming.
"I ran back, past bodies on the beach to reach our hotel. It was chaos - there was a body in the hotel pool and it was just full of blood.
Local media reported a second suspected attacker had been arrested, but this has not been confirmed.
IS had urged followers to step up assaults during the holy Muslim month of Ramadan.
Friday's attack was the deadliest in Tunisia's recent history. The country has seen militant Islamists gain strength since the overthrow of long-serving ruler Zine al-Abidine Ben Ali in in 2011.
Democratic elections after Ben Ali's removal saw the moderate Islamist Ennahda party take power before the secularist Nidaa Tounes government won a parliamentary poll in October.
However, neither party has been able effectively to combat Islamist violence - which has been made worse by conflict in neighbouring Libya and by Tunisian fighters returning home after joining Islamist campaigns in Iraq and Syria.
Day of attacks
The shooting in Tunisia came on the same day as:
We are seeking your stories relating to the Tunisia attacks. If you or anyone you know has been affected please contact us in the following ways, and include a contact number if you are willing to speak to a BBC journalist.
Whatsapp: +44 7525 900971
Send an SMS or MMS to 61124
Read our terms and conditions.