TUNIS, Tunisia (AP) — The two gunmen who killed 21 people at a museum in Tunis trained in neighboring Libya before carrying out the deadly attack and were known to authorities, Tunisian security officials said Friday.

The attack at the National Bardo Museum Wednesday has raised concerns about the spread of extremism in North Africa and particularly in Tunisia — the only country to emerge from the 2011 Arab Spring uprisings with a functioning democracy.

In the country's capital Tunis, hundreds citizens on Friday thronged the main avenue where demonstrators overthrew dictator Zine El Abidine Ben Ali four years ago, celebrating independence day in defiance of the attacks that left 17 cruise ship tourists dead.

Some danced draped in Tunisian flags and others held aloft hand-written signs that read "JeSuisBardo" for "I am Bardo," a slogan that has captured attention as an anti-terrorism rallying cry on social media.

"We are here to say 'no' to terrorism," said Astal Marwen, a 19-year-old political science and law student, at the rally. "The attackers are part of a small minority, and they have the wrong conception of what Islam is."

The attackers slipped out of the country in December and received weapons training in Libya which is awash in well-armed militias fighting for control, said Rafik Chelli, a top official in the Interior Ministry in a TV interview late Thursday.

One of them, Hatem Khachnaoui, 26, was from the central city of Sbeitla and had previously been arrested on terrorism charges before being released, according to Sabhi Jouini, a leading figure in the police union and a terrorism expert.

Sbeitla, home to some splendid Roman ruins, is in an impoverished region not far from the Algerian border where an al-Qaida-linked Tunisian group has carried out several attacks.

Khachnaoui's father and sister in Sbeitla were arrested Thursday along with two others from the region on suspicion of supporting the attackers. Another five people with direct connection to the attack were picked up around the capital.

Khachnaoui's associate, Yassine Laabidi was only 20 years old and had less of a record with police, though he is known to have worked in a travel agency and hails from the working class Tunis neighborhood of Ibn Khaldun.

The Islamic State group, based in Iraq and Syria, has claimed responsibility for the Bardo attack. Several well-armed groups in Libya have pledged their allegiance to the Islamic State.

Confronted with a poor economy, young Tunisians have disproportionately gone abroad to fight with extremist groups in Libya, Syria and Iraq, including some affiliated with the Islamic State. Tunisian authorities have estimated that of the 3,000 young people who left the country to fight with radical groups, about 500 have returned.

In claiming responsibility for the attack, IS issued a statement and audio on jihadi websites applauding the dead gunmen as "knights" for their "blessed invasion of one of the dens of infidels and vice in Muslim Tunisia."

Analysts cautioned against seeing every such attack as evidence of a well-organized, centrally controlled entity spanning the Middle East, saying instead that small groups could merely be taking inspiration from the high-profile militant group.

Early Friday, victims' families continued to arrive at Tunis' Charles Nicolle hospital to help identify the dead and recover their bodies.

The latest tally of victims included four Italians, three Japanese and three French, two Spanish and two Colombians and one citizen each from Britain, Poland and Belgium, said Samar Samoud, medical adviser to the Tunisian health minister. The nationalities of three victims remain unclear.

French President Francois Hollande confirmed the French dead and said two others were in intensive care while five were only lightly wounded and would be returning to France tonight.

Two of the cruise ships that had passengers killed or wounded in the Tunis attack sailed into Spanish ports on Friday, with disembarking passengers telling reporters chilling tales of how they just missed being victims.

In Palma, Spanish cruise ship passenger Catalina Llinas told reporters she and her husband luckily chose a day trip Wednesday to the Roman ruins of Carthage near Tunis instead of the museum excursion. The couple's tour bus, she said, passed by the Bardo museum just 10 minutes before the attacks.

"It could have been us," she said.

The deaths of so many foreigners will damage Tunisia's tourism industry, which draws thousands of foreigners to its Mediterranean beaches, desert oases and ancient Roman ruins. The industry had just started to recover after years of decline. The two cruise ship lines who had passengers killed in Tunis on Wednesday announced they were dropping Tunis from their itineraries for now.


Maamoun Youssef in Cairo contributed to this report.