Foreign tourists scrambled in panic Wednesday after militants stormed a museum in Tunisia's capital and killed 19 people, "shooting at anything that moved," a witness said.

Two gunmen were slain by security forces following the deadliest attack on civilians in the North African country in 13 years, and the president said the young democracy was embroiled in a war with terror.

The militants, who wore military-style uniforms and wielded assault rifles, burst from a vehicle and began gunning down tourists climbing out of buses at the National Bardo Museum. The attackers then charged inside to take hostages before being killed in a firefight with security forces.

Authorities launched a manhunt for two or three accomplices in the attack. Prime Minister Habib Essid said the two Tunisian gunmen killed 17 tourists:

5 from Japan.

4 from Italy.

2 from Colombia.

2 from Spain.

1 each from Australia, Poland and France.

The nationality of one dead foreigner was not released. Essid said two Tunisian nationals also were killed by the militants. At least 44 people were wounded, including tourists from Italy, France, Japan, South Africa, Poland, Belgium and Russia, according to Essid and doctors from Tunis's Charles Nicolle Hospital.

Foreign Affairs said in an emailed statement on Wednesday evening that it had no reports of Canadians affected in the attack.

"I want the people of Tunisia to understand firstly and lastly that we are in a war with terror, and these savage minority groups will not frighten us," said newly elected President Beji Caid Essebsi in an evening address to the nation. "The fight against them will continue until they are exterminated."

Prime Minister Stephen Harper tweeted that he was horrified to learn of the attacks.

"Canada stands with our allies in condemning these barbaric acts," the tweet said.

Tunisian officials say 21 people died in the attack on a Tunisian museum, including 17 tourists, two Tunisians and two gunmen. (Fethi Belaid/AFP/Getty Images)

Tunisians overthrew their dictator in 2011 and kicked off the Arab Spring that spread across the region. While the uprising built a new democracy, the country has also struggled with economic problems and attacks by extremists.

Essid identified the slain gunmen as Yassine Laabidi and Hatem Khachnaoui.

Twitter accounts associated with the extremist Islamic State group based in Syria and Iraq were described as overjoyed at the attack, urging Tunisians to "follow their brothers," according to Rita Katz of SITE, a U.S.-based organization that monitors militant groups.

The assault at the Bardo, Tunisia's largest museum that is housed in a 15th century palace, began sometime after noon local time as scores of European tourists were visiting.

'Shooting at anything that moved'

Josep Lluis Cusido, the mayor of the Spanish town of Vallmoll, said he saw people being gunned down on the plaza outside the museum before the gunmen moved inside.

"After they entered the museum. I saw their faces: They were about 10 metres away from me, shooting at anything that moved," Cusido told Spain's Cadena Ser radio station.

"I managed to hide behind a pillar, there were unlucky people who they killed right there," he said, adding that he and his wife spent nearly three hours in the museum until they got out uninjured.

Dozens of tourists scrambled from the museum linking arms or clutching children as Tunisian police and security forces pointed their weapons at the building. The museum, 4 kilometres from the city centre, is located near the national parliament building, which was evacuated.

Some of the Italians at the museum were believed to have been passengers from the Costa Fascinosa, a cruise liner that had docked in Tunis while on a seven-day tour of the western Mediterranean. Ship owner Costa Crociere confirmed that some of its 3,161 passengers were visiting Tunis and that a Bardo tour was on the itinerary, but said it couldn't confirm how many were in the museum at the time.

The Bardo, a popular tourist attraction, houses one of the world's largest collections of Roman mosaics among its 8,000 works.

Tunisians holding candles prayed at the entrance gate of the National Bardo Museum after the attack, which left dozens wounded. (Michel Euler/Associated Press)

On Wednesday night, parliament held an extraordinary session where Speaker Mohammed Ennaceur called for the creation of a special fund to combat terrorism. He also called for the rapid passage of the anti-terror law that parliament had been debating when the attack took place.

Hours after the police ended the siege, thousands of Tunisians flocked to downtown's landmark Bourguiba Avenue, where the revolution took place, for a nighttime rally. They chanted for a "Free Tunisia" in defiance of terrorism.

Essid said the attack was an unprecedented assault on the economy. It came as Tunisia's all-important tourism business was starting to rebuild after drastic losses following the post-revolutionary turmoil. Numbers of arrivals for 2014 had begun to approach the levels of 2010 — before the revolution.

It was the worst attack in the country since an al-Qaeda militant detonated a truck bomb in front of a historic synagogue on the Tunisia's island of Djerba in 2002, killing 21, mostly German tourists.

Tunisia has been more stable than other countries in the region, but has struggled with violence by Islamic extremists who have sworn allegiance to both al-Qaida and the Islamic State group.

A disproportionately large number of Tunisian recruits — some 3,000, according to government estimates — have joined Islamic State fighters in Syria and Iraq and many have received training in neighboring Libya.

The U.S. Embassy in Tunis was attacked in September 2012, seriously damaging the embassy grounds and an adjoining American school. Four of the assailants were killed.

Masked Tunisian soldiers stand guard outside the museum in Tunis. (Michel Euler/Associated Press)

Overall, though, violence in Tunisia in recent years has been largely focused on security forces, not foreigners or tourist sites.

In October 2013, a young man blew himself up on a beach in the coastal town of Sousse after being chased from a hotel, causing many to expect a new wave of attacks on tourism. None materialized until now.

The United States, France, the United Arab Emirates and the United Nations denounced the bloodshed. U.S. Secretary of State John Kerry said Washington "condemns in the strongest possible terms today's deadly terrorist attack" and praised Tunisia's "rapid response" to resolve the hostage situation and restore calm.

Speaking at the Louvre museum to call for international efforts to preserve the heritage of Iraq and Syria against extremist destruction, French President Francois Hollande said he had called Tunisia's president to offer support and solidarity.

"Each time a terrorist crime is committed, we are all concerned," Hollande said.