CAIRO — The Islamic State and other extremists on Thursday sought to claim responsibility for the deadly attack that killed at least 21 people at the National Bardo Museum in Tunis. The authorities there arrested at least nine people suspected of being accomplices as major cruise lines indefinitely suspended stops in Tunisia, a sign of the looming toll on the crucial tourist industry.

The assault was the latest evidence that the extremist victories and cruelties in Syria, Iraq and elsewhere are emboldening like-minded militants to acts of violence around the world — including recent attacks in Paris, Ottawa and Sydney, Australia.

The eagerness of the Islamic State and other jihadists to associate themselves with the killings in Tunis underscored the looseness of their proliferating networks, recalling the distant ties to both the Qaeda and Islamic State networks among the assailants who attacked the satirical newspaper Charlie Hebdo in Paris two months ago.

The massacre of tourists on Wednesday, scholars said, was in some ways a throwback to the tactics that older militant groups had relied on in the 1980s and ’90s. But the attack also comes at a time when some Islamist militants elsewhere, most notably in Egypt, are gravitating to the idea that economic interests may be a vulnerable point they can exploit to destabilize governments.

A statement about the attack posted by the Afriqiyah Media, a jihadi forum often used by Uqba bin Nafa, a Tunisian group linked to Al Qaeda, even included graphs and price charts to show the economic pain the museum assault had already inflicted.

Celebrating “the sharp collapse of the Tunisian markets after a simple operation involving only two individuals,” the statement asked, “What do you think would happen if an organized attack happened, and simultaneously on several military, vital and tourist targets?”

Image

Demonstrators in Tunis on Thursday, a day after gunmen attacked the National Bardo Museum. The Islamic State and another terror group claimed responsibility.CreditChristophe Ena/Associated Press

Some analysts said they saw an ominous trend. “The shooting spree tactic is really catching on, and that is going to be a huge headache for security services around the world,” said Will McCants, a scholar of Islamist militancy at the Brookings Institution, noting the similarities with recent attacks on the Canadian Parliament building and Charlie Hebdo.

Brian Fishman, a researcher at the New America Foundation in Washington, said he, too, foresaw more low-tech assaults, “because these attacks are easy.”

Tunisian officials said Thursday that they had not yet found evidence tying either of the two gunmen to any known terrorist group. Both men were killed by security forces in a gunfight at the museum, and the authorities identified them as Yassine Laabidi and Hatem Khachnaoui, both Tunisian.

Prime Minister Habib Essid said in an interview with the French radio network RTL that Mr. Laabidi had caught the attention of the country’s intelligence agencies in the past, but not for “anything special.”

The Tunisian authorities are working with other governments to learn more about the men’s backgrounds and motives, he said, adding at a news conference later that Tunisia was obtaining military equipment from allies, including eight helicopters equipped for nighttime surveillance, to aid its hunt for militants. Mr. Essid did not specify which countries, but the United States has already approved the sale of a number of UH-60M Black Hawk helicopters to Tunisia.

“Such operations take place in the U.S., in France, in Egypt,” Mr. Essid said of the attack.

The authorities said the Tunisian Army would be deployed to cities to bolster the police, and Mr. Essid asked Tunisians for their forbearance regarding searches and checkpoints.

Image

Police kept watch outside the National Bardo Museum on Thursday, as officials said they had found no ties between the gunmen responsible for an attack there and any known terrorist group.CreditMohamed Messara/European Pressphoto Agency

“We are now in a phase of chasing after some terrorists who contributed indirectly to yesterday’s operation in the Bardo Museum,” he said. “The citizens must deal with this process with the utmost good will.”

President Beji Caid Essebsi said in a statement that four of the nine suspects under arrest had direct connections to the attack. He did not specify the exact reasons leading to the arrest of the other five. News reports indicated that the police had also arrested members of the family of one of the gunmen.

Separately, two Spanish tourists emerged Thursday from a hiding place inside the museum, according to news reports citing the Spanish foreign ministry. Tunisian health officials said at least two people who were wounded in the attack died overnight, raising the death toll to at least 21, not including the two gunmen.

Tunisia, the Arab Spring’s lone success, is seeking to consolidate its transition to democracy after the uprising four years ago that removed a longtime strongman, Zine el-Abidine Ben Ali.

The government has struggled to defeat Islamist militant groups, based mainly in the area around Mount Chaambi near the Algerian border. At the same time, the simmering frustrations of many young men with a sputtering economy and police abuses, which continued after decades of autocracy, have helped make Tunisia a leading source of foreign fighters for the Islamic State, also known as ISIS or ISIL, in its battles in Syria and Iraq.

Supporters of the Islamic State on Thursday circulated a terse audio statement from one of its media outlets claiming responsibility and naming the gunmen under the aliases Zakaria al-Tunisi and Abu Anas al-Tunisi.

Image

Security forces guarded the Parliament building in Tunis on Wednesday, after gunmen killed at least 20 people in an attack on a museum.CreditZoubeir Souissi/Reuters

“We tell the apostates who sit on the chest of Muslim Tunisia: Wait for the glad tidings of what will harm you, impure ones, for what you have seen today is the first drop of the rain, God willing,” the group said in the audio statement, according to a translation provided by the SITE Intelligence Group, an organization that tracks extremist groups.

“You will not enjoy security, nor be pleased with peace, while the Islamic State has men like these,” the statement said.

The statement offered no evidence that the group had played a role in the attack, and its claims could not be confirmed.

The Islamic State was not the only group to seek to associate itself with the attack. Afriqiyah Media posted a more detailed message recounting the chronology. Yet much of what it listed could have been gleaned from news media reports, and some of its assertions contradicted the accounts of witnesses and Tunisian officials.

Its message rendered the names of the gunmen as Yassin al-Obeidi and Sabr al-Khachnaoui, according to a translation by the SITE Intelligence Group. Photographs included in the message appeared to show the bodies of the attackers — young men with assault rifles, each lying in a pool of blood and wearing running shoes and casual clothes. Tunisian officials had said the attackers wore military uniforms.

Instead of claiming responsibility, Afriqiyah Media at times appeared to tease the authorities. “We will not answer this now, in order to listen to more of your ridiculous analysis and your weeping and crying on television and radio, and to laugh more at the inefficiency of your apostate masters,” it said.

Most of all, the message reveled in the damage done to the Tunisian economy at such a bargain price. “Just two Kalashnikovs, four hand grenades, and some bullets,” Afriqiyah Media’s statement said. “The total price did not exceed 4,000 dinars.”

“Instead of spending 3,000 dinars to enter Libya via smuggling for the pursuit of martyrdom, you can purchase a weapon and attack in the heart of the state of the tyrant and kill its police and soldiers,” the statement encouraged.

Scholars of extremism said this attack harkened back to an earlier era of jihadi violence, like the massacre of more than 60 people outside an ancient temple in Luxor, Egypt, in 1997 by militants with assault rifles. Then, too, the extremists hoped that driving away tourists would undermine the economy and thus weaken and topple the state.

Instead, the cruelty of the slaughter and the damage to the economy alienated average Egyptians and strengthened support for President Hosni Mubarak. The Luxor attack cleared the way for a decisive crackdown.

Most extremists had accepted that attacks on tourists were “a model that across the jihadi world has always failed,” said Mokhtar Awad, a researcher at the Center for American Progress in Washington, but the Tunisian attackers appear to have dusted it off. “It shows they have obviously not thought it through,” he said. “People are going to start to hate you.”

Some young Islamists in Egypt have also begun carrying out violent attacks against business interests as a means of bringing down the military-backed government. But they have so far mainly attacked empty buildings in an attempt to minimize casualties, seeking to avoid triggering a popular backlash or reinforcing the police state.

The spectacular success of other extremists around the region, however, appears to have emboldened even amateurs.

Their interest is visible on social media, where some aspiring jihadists have begun using the hashtag, in Arabic, “Lone Wolf.”

In one Twitter message this week that appeared to come from Egypt, for example, a user who called himself roughly Abu Mos’ab the Cairene laid out his dreams very plainly: “Brothers, a very important request,” he wrote. “I want any video to learn how to shoot, or to learn how to use guns.”

Correction:

Because of an editing error, an earlier version of this article referred incorrectly in some passages to a message about the museum attack posted online by the Uqba ibn Nafi Battalion. The message was in the form of a written statement with photographs; it was not a video.

Reporting was contributed by Mayy El Sheikh from Cairo, Carlotta Gall and Farah Samti from Tunis, Elisabetta Povoledo from Rome, and Eric Schmitt from Washington.

A version of this article appears in print on , on Page A6 of the New York edition with the headline: Militants, ISIS Included, Claim Attack in Tunisia. Order Reprints | Today’s Paper | Subscribe