At least 19 people were killed after two gunmen stormed one of Tunisia's most celebrated museums on Wednesday. No group asserted responsibility for the assault in Tunis, though suspicion fell immediately on Islamist militants.

Seventeen of the dead are thought to be tourists, mostly European nationals. It's a huge blow for a country whose economy relies greatly on visitors flocking to its Mediterranean beaches and ancient ruins. "This is a cowardly act to undermine our economy and a vital sector contributing to it," Tunisian Prime Minister Habib Essid said.

The attack, one of the worst in Tunisia's history, highlights the violence that has flared in the country, even as its fledgling democracy has been hailed as the sole remaining success story of the 2011 Arab uprisings.

Rising militancy

The attack on the Bardo National Museum comes amid rising concerns of Islamist militancy in this tiny North African country, which is predominantly Muslim but was ruled for decades by staunch secularists. Since the fall of entrenched autocrat Zine el-Abidine Ben Ali in 2011, an event that kick-started pro-democracy movements elsewhere in the Arab world, Islamist extremists have found more adherents in Tunisia — although they remain a small minority. Sluggish economic growth and high unemployment among youths, which spurred the protests against Ben Ali, have remained significant problems.

Ansar al-Sharia, a Salafist extremist group linked to al-Qaida, has gained strength, appealing largely to poor, disenfranchised Tunisian youths. The organization is suspected to be behind a spate of assassinations and terror attacks, including an assault on the U.S. Embassy in 2012. A prominent commander affiliated with the group was slain last week in Libya while fighting alongside a faction allied to the Islamic State militant organization.

Tunisians were among the largest groups of foreign fighters who journeyed to Syria and Iraq to join the Islamic State. The government reportedly arrested some 1,500 militants last year.

Turbulent politics

Tunisian officials acknowledge that they woke up late to the threat posed by Ansar al-Sharia, which was declared a terrorist group only in 2013. Critics accused the then-governing Ennahda party, a moderate Islamist organization somewhat akin to Egypt's Muslim Brotherhood, of not taking the militant threat seriously enough.

Things changed after the assassinations of two prominent leftist politicians by Islamist extremists. Anti-Islamist protests rocked Tunis, and a staunchly secularist party with ties to the old regime won the country's first free and fair elections at the end of last year.

In the years after Ben Ali's departure, Tunisia struggled to build a stable and inclusive political system. Deep divisions between secularists and Islamists led to a political crisis in 2013 that forced Ennahda to step down. But civil society groups promoted a "national dialogue" that resulted in the elections last year and the passage of a new constitution, the most liberal in the Arab world.

But at present, Ennahda has been shut out of the new government, raising fears of a deepening polarization.

Secularists vs. Islamists

Tunisia's preeminent post-independence leader and Ben Ali's predecessor, Habib Bourguiba, left his mark with secularist laws and anti-Islamist initiatives. He ridiculed the female practice of wearing a hijab and once famously drank orange juice during a Ramadan telecast. He also presided over the arrests of thousands of Islamist dissidents.

After the 2011 uprising, Tunisia's Islamists came out of the cold. Leading politicians ended decades in exile, while a variety of Islamist organizations were for the first time able to conduct their activities in the open.

This led to friction. In 2012, Salafist rioters, incensed by a supposedly blasphemous art exhibition, went on a rampage and attacked government offices. In the same year, a leading TV network chief had his house firebombed and was charged in court with "violating public morals" after airing an animated film.

The backlash against the Islamists intensified after the killing of Chokri Belaid, a popular leftist leader, in 2013. A secularist party came in first in legislative elections in October 2014, and one of its members won the presidency.

There are reasons to be optimistic about Tunisia's future, even in the aftermath of Wednesday's terror attack. Ennahda remains a significant force in opposition — a far cry from Egypt, another Arab Spring nation, where the Muslim Brotherhood government was thrown out by the military, and its leaders and thousands of activists were put in jail. Tunisia has strong civil society organizations, unlike most of its neighbors.

Ennahda issued a statement denouncing the museum attack and stressed that "this crime will not break our people's will and will not undermine our revolution and our democracy."