Radicalized, trained in Libya, and already in police files, the two young men who shot dead 21 people at a renowned Tunisian museum embody what many see as the main threat to this North African country bent on building democracy.
Celebrating the 59th anniversary of its independence Friday, Tunisia was coming to grips with the hundreds of disaffected youths who have sought training in weapons and battle skills in its chaotic eastern neighbor and elsewhere and are returning to threaten the country.
"Tunisia has taken important steps in the political and democratic arena, which have been praised by the entire world. We must continue on this path," said President Beji Caid Essebsi in a televised holiday address.
The Wednesday attack on the National Bardo Museum, which left 20 foreigners, a Tunisian special forces officer and the two gunmen dead, was a "great disaster," he said, but pointed out that security measures were already being set up to prevent similar attacks in the future.
The gunmen, Hatem Khachnaoui and Yassine Laabidi, had slipped across the border in December to reach one of many militia camps in Libya, Rafik Chelli, a top Interior Ministry official said in a TV interview. Since the ouster of Moammar Gadhafi three years ago, Libya has fallen into chaos and is now awash in well-armed militias fighting for control.
On the anniversary of Tunisia's independence from France, French Interior Minister Bernard Cazeneuve became the first high level foreign official to visit the country in the wake of the attacks and he promised Tunisia material and intelligence help in fighting terrorism and strengthening its border security.
"The state has been considerably weakened by its porous borders between Libya and Tunisia," he told reporters. "The control of borders is important and we can work on it by mobilizing our skills and means."
The attackers followed a well-worn trail trekked by many young Tunisians who were disillusioned when the promises of the 2011 revolution were slow in coming and were radicalized in extremist mosques or through online religious propaganda.
With authorities tightening control on airports, it was the land journey across the Libyan border that these young, jobless men would take, with many staying to join the ranks of radical groups in Libya.
Increasingly over the past year, there have been reports about Tunisians killed in the Libyan fighting.
Several militias in Libyan cities like Derna in the east and Sirte in the center have declared allegiance to the Islamic State group, which has claimed responsibility for the attack in Tunis, describing the young gunmen as "knights" and promising more attacks.
"As long as Libya stays as it is now, our country will still be threatened by these phenomena. So we have to look for a resolution in Libya," said Rachid Ghannouchi, the leader of Tunisia's powerful moderate Islamist Ennahda party.
Speaking Friday at the opening of the latest round of peace talks between Libya's rival parliaments, UN envoy Bernardino Leon said the bombing in Tunisia added even more urgency to efforts to reconcile Libya's warring factions.
"It is another alarm sign that we have to take into account for what is going on in the region," he said. "Terrorism in Libya is becoming a problem for Libyans and a problem for the region."
The Tunisian government estimates that some 3,000 young men have left to join extremists groups with at least 500 coming back. Most return disgusted with the fighting, but for some it's a chance to carry out operations at home.
Of the two men, Khachnaoui, 26, was the more dedicated radical. He had already been arrested by police on terrorism charges, said Sabhi Jouini, a security expert and high official in Tunisia's police union. He said the man was released because of the lack of tough anti-terror legislation and disappeared soon afterwards.
When the attack took place, Tunisia's parliament, which is next to the museum, was listening to arguments about a new anti-terrorism law.
Khachnaoui hailed from Sbeitla, a small arid town surrounding picturesque Roman ruins in Tunisia's impoverished interior. It is not far from Mount Chaambi, where a few hundred radical fighters with allegiance to al-Qaida have been holed up for the last few years, carrying out attacks mostly against Tunisian soldiers.
Laabidi had also come to police attention, but for just minor infractions and he worked at a travel agency. Just 20 years old, he came from a working class neighborhood not far from the museum he stormed on Wednesday.
On Friday, Tunisians rallied along Bourguiba Avenue downtown to celebrate independence from France in 1956 and express their defiance against the terrorists who left 17 cruise ship passengers and three other foreigners dead.
Some revelers 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 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. Three victims remained unidentified.
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 the siege announced they were dropping Tunis from their itineraries for now.
Maamoun Youssef in Cairo and Paul Schemm in Rabat, Morocco, contributed to this report.