ISIS claims Tunisia attack
The Islamic State group (IS) claimed responsibility for the attack that killed 21 people at a Tunis museum.
But Tunisian authorities said the two dead gunmen had no clear links to extremists, and analysts said existing militant cells are merely being inspired by the group, rather than establishing its presence across North Africa.
Police announced the arrest of five people described as directly tied to the two gunmen who opened fire on Wednesday at the National Bardo Museum.
Four others said to be supporters of the cell were also arrested in central Tunisia, not far from where a group claiming allegiance to al Qaida's North African branch has been active.
Tunisians stepped around trails of blood and broken glass outside the museum to rally in solidarity with the 21 victims - most of them foreign tourists from cruise ships - and with the country's fledgling democracy.
Marchers carried signs saying "No to terrorism" and "Tunisia is bloodied but still standing".
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".
Several well-armed groups in neighbouring and chaotic Libya have already pledged their allegiance to IS based in Iraq and Syria.
But the attack of such magnitude in Tunisia - the only country to emerge from the Arab Spring uprisings with a functioning democracy - raised concern about the spread of extremism to the rest of North Africa.
Analysts warned against seeing every such attack as evidence of a well-organised, centrally controlled entity spanning the Middle East, saying instead that small groups could merely be taking inspiration from the high-profile militant group.
"I think (the Islamic State) is probably taking credit for something it may not have played a role in," said Geoff Porter, a security analyst for North Africa.
Even as it is under pressure from rival militias in Libya and US-backed forces in Iraq, the extremist group appears to be trying to raise its profile by associating itself with attacks around the region.
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 IS.
Upon their return home, some may have decided to carry out attacks on their own.
Tunisian authorities have estimated that of the 3,000 young people who left the country to fight with radical groups, about 500 have returned.
"It could have been people who fought with the Islamic State or were inspired by it," said Raffaello Pantucci, director of International Security Studies at the Royal United Services Institute, a British think tank.
"Some guys may have come back, not liked what the government is doing, and attacked the tourist industry to hurt the economy - a classic move."
Until now, Tunisia's most deadly group was the Oqba Ibn Nafaa brigade, which is allied to al Qaida and based in the mountains near the Algerian border. Previously, it has confined its attacks to political figures and security services.
While militant attacks may not necessarily have been centrally planned, they have succeeded in spreading fear and damaging the economy - and giving the impression of an all-powerful radical Islamic network extending its reach.
Tunisia is particularly vulnerable to such attacks because its economy has struggled since the country became the birthplace of the Arab Spring by overthrowing its dictator in 2011.
Yesterday, Prime Minister Habib Essid announced new security measures around the country, including a crackdown on websites seen as promoting terrorism.
US president Barack Obama spoke to Tunisian president Beji Caid Essebsi by phone to offer his condolences, sympathy and support. The White House says Mr Obama offered to keep providing assistance to Tunisia as the investigation proceeds.
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.
Two cruise ships that had 17 passengers among the dead quickly left the port of Tunis early yesterday, citing safety concerns, and the vessels' operators suspended visits to the country.
Culture minister Latifa Lakhdar gave a defiant news conference at the museum, where blood still stained the floor amid the Roman-era mosaics.
"They are targeting knowledge. They are targeting science. They are targeting reason. They are targeting history. They are targeting memory, because all these things mean nothing in their eyes," she told reporters.
In the afternoon, the authorities opened the gates of the museum for a rally in defiance of the bloodshed. About 500 people - some carrying flowers for the victims - held a moment of silence before singing Tunisia's national anthem.
Participants included black-robed lawyers, families with children, and teenagers swathed in the red-and-white Tunisian flag.
A funeral was held for Aymen Morjen - an elite member of Tunisia's security force who was killed at the museum. Interior minister Mohamed Najem Gharsalli and house speaker Mohamed Ennaceur attended the service.
It was among the museum's Roman-era mosaics that the militants dressed in military uniforms and armed with grenades and assault rifles took hostages and began shooting the foreigners.
"Suddenly, we started to hear the gunshots, so we all tried to escape and all of us tried to save ourselves as best we could," said Bruna Scherini, an Italian who arrived by cruise ship.
She told Sky TG24 from her hospital bed: "We tried to hide behind the exhibits and in the corners where there was a little hiding place."
A Spanish man and a pregnant Spanish woman who survived hid in the museum all night in fear. Spain's foreign minister said police searched all night before Juan Carlos Sanchez and Cristina Rubio were found by security forces.
Two Spaniards who died were celebrating their 50th wedding anniversary, and it was the first time they had travelled outside Spain, the minister said. Their two children were flying to Tunis to retrieve the bodies.
The health ministry said the death toll rose to 23 yesterday - 20 of them foreign tourists. Nearly 50 people were wounded. Three Tunisians were killed, including the two attackers.
Dr Samar Samoud of the ministry said six of the dead foreigners remained unidentified. She listed the rest of the foreign victims as three from Japan, three from France, two from Spain, and one each from Australia, Colombia, Britain, Poland, Belgium and Italy.
The Costa Crociere cruise line said four Italians and a Russian were among the dead. It was not immediately clear whether they were the victims not yet identified by the ministry. MSC Cruises said 12 of its guests were killed.
The two cruise lines said they suspended visits to Tunisian following the attack.
MSC chairman Pierfrancesco Vago said the company hoped to return to Tunisia, but that for now tourists view it as a "no-go zone".
MSC said it was suspending Tunisian ports of call for the rest of the 2015 summer season, with its ships docking instead in Malta, Palma de Mallorca, Sardinia or Corfu, Greece.
The two Spaniards who died were celebrating their 50th wedding anniversary, and it was the first time they had traveled outside Spain, the Spanish foreign minister said. Their two children were flying to Tunis to retrieve the bodies.