The brazen daylight assault yesterday sparked panic at the nearby parliament and the National Bardo Museum itself, a magnet for the tourists who contribute so much to the economy.
The gunmen, dressed in military uniforms, opened fire on the tourists as they got off a bus then chased them inside the museum, said Prime Minister Habib Essid.
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.
Police killed two gunmen and the authorities were still hunting for possible accomplices, said the prime minister.
More From This Section
A Tunisian bus driver and a policeman were also reported dead in the attack on the Bardo, famed for its collection of ancient artefacts.
President Beij Caid Essebsi, who visited some of the dozens being treated for wounds in a Tunis hospital, denounced the "horrible crime".
"I want the Tunisian people to understand that we are in a war against terrorism and that these savage minorities do not frighten us," he said.
The government announced 42 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 what they called terrorists.
It also drew strong condemnation from world leaders.