Tunisia's president promised to wage a "merciless war against terrorism" after gunmen killed 17 foreign tourists and two Tunisians in a daylight attack in the birthplace of the Arab Spring.
As the international community denounced Wednesday's assault on the National Bardo Museum in Tunis, which also left more than 40 people wounded, President Beij Caid Essebsi vowed Tunisia would fight "to our last breath".
"I want the Tunisian people to understand that we are in a war against terrorism and that these savage minorities do not frighten us," said Essebsi, who visited some of the dozens being treated for wounds in a Tunis hospital.
"We will fight them without mercy to our last breath."
The gunmen, dressed in military uniforms, opened fire on the tourists -- including visitors from Italy, France, Australia, Colombia, Poland and Spain -- as they got off a bus then chased them inside the museum, said Prime Minister Habib Essid.
A Japanese survivor described how she and her mother were shot in the hail of bullets.
"I was crouching down with my arms over my head, but I was shot in the ear, hand and neck," 35-year-old Noriko Yuki said from her hospital bed in comments aired by Japanese broadcaster NHK.
"My mother beside me was shot in the neck. Mother couldn't move by herself when the police came over," she added.
Among the dead were five Japanese, four Italians, two Colombians and one each from Australia, France, Poland and Spain, Essid announced on television, in what he said was a definitive toll.
However, differing figures were given by other governments and there was conflicting information over the breakdown, with some of the dead identified as joint nationals.
The nationality of a 16th victim was not given, while the identity of the final fatality had not yet been established.
The Colombian tourists were a mother and child visiting Tunisia on a family holiday, their government said. The father survived the attack.
Police killed two gunmen and the authorities were still hunting for possible accomplices, said the prime minister.
A Tunisian bus driver and a policeman were also reported dead in the attack on the Bardo, famed for its collection of ancient artefacts.
The government announced more than 40 people were wounded, with health minister Said Aidi saying they included citizens of France, South Africa, Poland, Italy and Japan.
The attack appeared to be the worst on foreigners in Tunisia since an al Qaeda suicide bombing of a synagogue killed 14 Germans, two French and five Tunisians on the island of Djerba in 2002.
It sparked outrage, with hundreds of people gathering later in a major thoroughfare of the capital, singing the national anthem and shouting slogans against the attackers, labelling them terrorists.
The assault also drew strong condemnation from world leaders, who vowed support for Tunisia.
US Secretary of State John Kerry denounced the "wanton violence" while British Prime Minister David Cameron said he was "appalled" by the attack and French President Francois Hollande expressed "solidarity" with the country.
United Nations Secretary-General Ban Ki-moon slammed the "deplorable" and "heinous" act and conveyed his "deepest sympathies" to the families of the victims.
Meanwhile the UN Security Council stressed that "no terrorist attack can reverse the path of Tunisia towards democracy".
Police officers stand outside Tunis Parliament after gunmen in military uniforms stormed the country's national museum. (Reuters)
There was no claim of responsibility, but Tunisia has struggled to tackle a rise in attacks from Islamist extremists.
Interior ministry spokesperson Mohamed Ali Aroui told reporters "two or more terrorists armed with Kalashnikovs" had targeted the museum, where about 100 tourists had been inside.
"Anti-terrorist units" had entered the museum and, about four hours after the incident began, declared that "the operation is over".
Museum employee Dhouha Belhaj Alaya said she heard "intense gunfire" around noon.
"My co-workers were screaming 'Run! Run! Shots are being fired!'" she told AFP. "We escaped out the back door with co-workers and some tourists."
French tourist Fabienne recounted how she and others hid in one of the museum's galleries along with their guide.
"We couldn't see anything, but there must have been a lot of them. We were afraid that, at any moment, they would come kill us," she told France's BFM television.
Work was suspended at nearby parliament during the attack.
"There was enormous panic," lawmaker Sayida Ounissi wrote on Twitter, saying hearings on Tunisia's anti-terrorism law were taking place at the time.
Essid said there was a "possibility" that the gunmen could have accomplices, and that authorities were "conducting extensive search operations to identify the two or three terrorists who possibly participated in the operation".
Jihadists coming home
Tunisia has seen an upsurge in Islamist extremism since the 2011 revolution that ousted longtime strongman Zine El Abidine Ben Ali.
Dozens of police and military personnel have been killed or wounded in attacks blamed on Islamist militants.
An army offensive against the jihadists, who are linked to al Qaeda in the Islamic Maghreb, has been under way since 2012 but the ground and air campaign has failed to eliminate them.
The country is also fighting against the radicalisation of Muslim youth. Authorities say as many as 3,000 Tunisians have gone to Iraq, Syria and neighbouring Libya to fight in jihadist ranks, including with the Islamic State group.
Some 500 jihadists are believed to have since returned home.
Essebsi said the "top priority" for the government, which took office last month after Tunisia's first free elections, is "providing security and the battle against terrorism".
Tunisia kicked off the Arab Spring and has taken pride in forming a democratic government and achieving stability -- in marked contrast to neighbours such as Egypt and Libya.
It is hoping to rebuild its once-burgeoning tourism industry, which is struggling to recover from the effects of the revolution.
Video: Shooting attack on Tunisia museum leaves 19 dead