Tunisia said it would deploy the army to major cities and arrested nine people on Thursday after 20 foreign tourists were shot dead at a museum in the capital in an attack claimed by Islamic State.
Officials did not confirm the claim, but said they had identified the two militants shot dead by security forces after opening fire on tourist buses visiting the Bardo museum inside Tunisia's heavily guarded parliament compound on Wednesday.
Cruise liner MSC Cruises said 12 of its passengers, including Colombians, French and a Belgian, were among the dead, while a Spanish couple was found alive on Thursday after hiding all night in the museum.
Japanese, Italian, Spanish and British visitors, as well as three Tunisians, were among the victims.
The assault -- the most deadly attack involving foreigners in Tunisia since a 2002 suicide bombing in Djerba -- came at a fragile moment for a country just emerging to full democracy after its pioneering popular uprising four years ago.
It is heavily reliant on foreign tourists to its beach resorts and desert treks, and the government was about to tackle politically sensitive reforms aimed at boosting economic growth.
The Islamic State militant group, which has declared a caliphate in large parts of Iraq and Syria and is active in Tunisia's chaotic neighbor Libya, praised the two attackers in an audio recording in Arabic, calling them "knights of the Islamic State" armed with machineguns and bombs.
Tunisians make up the one of the largest contingents of foreign fighters in Syria, Iraq and Libya, and their homeland's young democracy, which has cracked down on militancy at home, was a clear potential target.
"We tell the apostates who sit on the chest of Muslim Tunisia: Wait for the glad tidings of what will harm you, o impure ones, for what you have seen today is the first drop of the rain," the Islamic State audio said.
The two dead militants were identified as Tunisians, Hatem al-Khashnawi and Yassin al-Abidi. Two local newspapers reported Abidi had spent time in Iraq and Libya, but officials did not confirm that.
Tunisia's Prime Minister Habib Essid said Abidi had been under surveillance but "not for anything very special".
"We have identified them, it is indeed these two terrorists," the premier told French RTL radio earlier on Thursday. "Their affiliation is not clear at the moment."
Authorities said they had arrested four people directly linked to the attack and five others with indirect ties. A security source said two family members of one of the gunmen were among those held. "We arrested the father and the sister of the terrorist Hatem Al-Khashnawi in the their home in Sbiba City," the source told Reuters.
The president's office said the army would be deployed to the streets as part of increased security following the attack. "After a meeting with the armed forces, the president has decided large cities will be secured by the army," it said.
The number of foreign tourists killed rose to 20 from 17, the health minister said. London said a British woman was among the dead in shootings it said were cowardly and despicable.
Spain said the woman in the couple who emerged from the museum alive on Thursday was pregnant. "They were hidden this whole time, without daring to make a phone call, probably because they were anxious and scared, as you can imagine," Spanish Foreign Minister Jose Manuel Garcia-Margallo said.
Four years after a popular revolt toppled autocrat Zine El-Abidine Ben Ali, Tunisia has completed its transition to democracy with free elections, a new constitution and compromise politics between secular and Islamist parties.
But security forces are battling Islamist militants including Ansar al Sharia, which is listed as a terrorist group by Washington, and Okba Ibn Nafaa, a brigade of al Qaeda-affiliated fighters operating in the Chaambi mountains along the Algerian border.
The fight against these militants may have played a role in prompting the museum attack, said Geoff Porter, security analyst at North Africa Risk Consulting. "Increasing pressure on terrorist activities in the Djebel Chaambi region may have squeezed the balloon, with terrorists seeking softer targets with more symbolic impact," he said.
A former commander in Tunisia's Ansar al Sharia was killed last week fighting for Islamic State in Libyan city of Sirte. He had been running training and logistics, security sources said.
Tunisian and foreign security services on Thursday were still piecing together whether the two young Tunisian militants were associated with Islamic State or an Al Qaeda in the Islamic Maghreb affiliated group.
Poland's Foreign minister Grzegorz Schetyna told local radio there were signs that the attackers were linked to Islamic State militants, but he gave no details.
A daily Islamic State news broadcast distributed online also mentioned the Tunis attack, describing the perpetrators as Mujahideen and asking God to receive them as martyrs in paradise. But it did not claim direct responsibility.
A social media account linked to Okba Ibn Nafaa brigade also provided details of the attack, without a direct claim of responsibility. But that group has also issued conflicting statements in the past about its position on Islamic State.
The Bardo attack appeared squarely aimed at Tunisia's economy, with tourism accounting for seven percent of gross domestic product. The government estimates that loses this season for the tourism sector would reach $700 million.
Two German tour operators said they were cancelling trips from Tunisia's beach resorts to Tunis for a few days and Accor, Europe's largest hotel group, said it had tightened security at its two hotels in Tunisia. Italy's Costa Cruises, a unit of Carnival Corp CCL.N, cancelled stops in Tunisia.