7 MIN. DE LECTURA
* Japanese, Italians, Colombians, Polish, among dead - PM
* Security forces kill two militants, free hostages
* Blow to country dependent on Western tourism
* Stock market falls, some tours cancelled (Updates nationalities, analyst remark)
By Tarek Amara and Mohamed Argoubi
TUNIS, March 18 (Reuters) - Gunmen wearing military uniforms stormed Tunisia's national museum on Wednesday, killing 17 foreign tourists and two Tunisians in one of the worst militant attacks in a country that had largely escaped the region's "Arab Spring" turmoil.
Five Japanese as well as visitors from Italy, Poland and Spain were among the dead in the noon assault on Bardo museum inside the heavily guarded parliament compound in central Tunis, Prime Minister Habib Essid said.
"They just started opening fire on the tourists as they were getting out of the buses ... I couldn't see anything except blood and the dead," the driver of a tourist coach told journalists at the scene.
Scores of visitors fled into the museum and the militants - who authorities did not immediately link to any extremist group - took hostages inside, officials said. Security forces entered around two hours later, killed two militants and freed the captives, a government spokesman said. A police officer died in the operation.
The attack on such a high-profile target is a blow for the small North African country that relies heavily on European tourism and has mostly avoided major militant violence since its 2011 uprising to oust autocrat Zine El-Abidine Ben Ali.
Several Islamist militant groups have emerged in Tunisia since the uprising, and authorities estimate about 3,000 Tunisians have also joined fighters in Iraq and Syria -- igniting fears they could return and mount attacks at home.
"All Tunisians should be united after this attack which was aimed at destroying the Tunisian economy," Prime Minister Essid declared in a national address.
The local stock exchange dropped nearly 2.5 percent and two German tour operators said they were cancelling trips from Tunisia's beach resorts to Tunis for a few days.
Accor, Europe's largest hotel group, said it had tightened security at its two hotels in Tunisia.
U.S. Secretary of State John Kerry joined leaders from Europe condemning the attack and said Washington continued "to support the Tunisian government's efforts to advance a secure, prosperous, and democratic Tunisia."
Television footage showed dozens of people, including elderly foreigners and one man carrying a child, running for shelter in the museum compound, covered by security forces aiming rifles into the air.
The Tunisian premier said 17 tourists were killed, including four Italians, a French citizen, a Pole, two Colombians, five Japanese, an Australian and two Spaniards. He had previous mentioned a German fatality, but did not mention that in later statements. Two Tunisians were killed.
The museum is known for its collection of ancient Tunisian artifacts and mosaics and other treasures from classical Rome and Greece. There were no immediate reports that the attackers had copied Islamic State militants in Iraq by targeting exhibits seen by hardliners as idolatrous.
Bardo's white-walled halls set in the parliament compound are one of the most popular tourist attractions in the Tunisian capital. Many tourists come for day trips to Tunis from nearby Mediterranean beach resorts.
Shocked but defiant, hundreds of Tunisians later gathered in the streets of downtown Tunis waving the country's red and white crescent flag, and chanting against terrorism.
"I pass this message to Tunisians, that democracy will win and it will survive," President Beji Caid Essebsi said in a television statement. "We will find more ways and equipment for the army to wipe out these barbarous groups for good."
Tunisia's uprising inspired "Arab Spring" revolts in neighbouring Libya and in Egypt, Syria and Yemen. But its adoption of a new constitution and staging of largely peaceful elections had won widespread praise and stood in stark contrast to the chaos that has plagued those countries.
After a crisis between secular leaders and the Islamist party which won the country's first post-revolt election, Tunisia has emerged as a model of compromise politics and transition to democracy for the region.
But the attack comes at a challenging time with Tunisia planning to reform its economy and cutback on public spending. Tourism represents around 7 percent of the gross domestic product.
Security forces have already clashed with some Islamist militants, including Ansar al-Sharia which is listed as a terrorist group by Washington. But until Wednesday most attacks were in remote areas, often near the border with Algeria.
Another group is holed up in the mountains along the Algerian border where the army has spent months trying to destroy their camps.
Affiliates of Islamic State militants fighting in Iraq and Syria have also been gaining ground in North Africa, especially in the chaotic environment of Tunisia's neighbour Libya, where two rival governments are battling for control.
A senior Tunisian militant was killed while fighting for Islamic State in the Libyan city of Sirte over the past week. Security sources said he had been operating training camps and logistics.
"An attack like this could strike the fragile transition in Tunisia, especially the tourism industry," said local political analyst Nourredine Mbarki. "The problem is now these groups have gone from being in mountains and borders to hit the capital and targets with high security."
Wednesday's assault was the worst attack involving foreigners in Tunisia since an al Qaeda suicide bombing on a synagogue killed 21 people on the tourist island of Djerba in 2002.
The most recent attack on the tourism industry in 2013 when a militant blew himself up at the Tunisian beach resort of Sousse, but no one else was killed or wounded. Another bomber was caught at a presidential monument before he blew himself up. (Additional reporting by Valentina Consiglio in Italy; Writing by Patrick Markey; Editing by Andrew Heavens and Diane Craft)