Inside a museum in Tunisia on Wednesday afternoon a young Colombian girl on a family vacation could not stop crying. She was not lost; her parents were standing beside her. She was scared. In front of her, a man was waving an assault rifle and shouting at her mom to make her stop crying. But she didn’t stop, until he shot her. She was one of the first to die in a terrorist attack by suspected Islamist militants that killed at least 21 people, 17 of whom were tourists. Sitting in a row on the museum's marble floor were more than a dozen other children and adults just like her, whose vacations had turned into terror.

When two gunmen opened fire at the National Bardo Museum in central Tunis, what ensued was the deadliest terrorist attack on civilians in the country in the last 13 years. That was a heavy blow to Tunisia not just for the loss of life, but because the country had appeared to be immune to the chaos engulfing North Africa and the Middle East; it had even managed to rebuild its huge tourism industry after the 2011 revolution that ousted a strongman president and ushered in a democratic, secular government. Now, Tunisia's role as the poster child of the Arab Spring is in jeopardy. But the signs of a looming crisis had been there. Tunisia had been harboring a jihadi risk that exploded on Wednesday after festering for months. 

Tunisia Hostages lined up in the National Bardo Museum in central Tunis after gunmen stormed the building killing at least 21 people, March 18, 2015. Photo: Mael Souddi/ Facebook

“This is a double strike against both our democracy and our economy,” Abdelfatah Mourou, vice speaker of Parliament, said Wednesday. “These people knew what they were doing.”

Tunisia, with a vibrant civil society and relatively free media, was touted as the one country that could emerge from the Arab Spring upheavals better off than before. But it has also become the main exporter of jihadi fighters to the Islamic State group's so-called caliphate and is perched next door to the chaos in Libya with its vast uncontrolled arsenal of weapons. It also depends heavily on tourism, which makes up almost 15 percent of its gross domestic product.

That is a dangerous combination, one that the museum terrorists homed in on with an attack timed to coincide with the arrival of two cruise ships loaded with international tourists. It also came right after the government cracked down on jihadist activity in the country.

“For a country like Tunisia, if you choke off tourist revenue that's certainly going to be a blow to the newly elected secular-leaning government,” said J. Peter Pham, director of the Atlantic Council’s Africa Center. “Tunisia relies heavily on tourism revenue.”

Since the 2011 revolution, which resulted in a temporary drop in tourists, the country has managed to reinvent itself as a major tourist destination on the Mediterranean. Tourism income has increased 24 percent from 2010 to 2015.

But tourism depends on safety and Wednesday’s shooting clearly targeted tourists. Nearly 200 tourists were thought to be in the museum during the attack, according to local media. So far, victims have been identified as four Italian nationals, two Spanish nationals, two French nationals, a Pole and a Japanese national. The young Colombian girl and her mother were both killed, but the girl's father survived and is being treated for shock. A Tunisian custodian who worked at the museum and Tunisian police officer also were killed. Dozens were wounded.

Tunisia’s tolerant atmosphere and its proximity to weapon-filled Libya have made it a country of high strategic importance to militant groups operating in the region. At least 3,000 Tunisian nationals have left the country to fight with the Islamic State group -- which is also known as ISIS or ISIL -- and some of them have risen in the group’s ranks, even becoming top leaders in ISIS’ newest addition, Libya.

For years, the Tunisian desert on the border with Libya has been home to training camps for various jihadist groups flush with weapons left over from Moammar Gadhafi’s regime. The crossing has also been one of the main stops for North Africans hoping to get to Syria to join ISIS. However, recent government crackdowns have made Tunisia less of an asset for jihadist groups, and may have played a part in triggering the attack.

“You want to keep that safe territory or passage territory or rear base open, and when you’re denied that then you begin to lash out,” Pham said.

In the past week, the Tunisian government has stopped at least 10 people from crossing the border into Libya to join the Islamic State group and dismantled a recruitment cell in the country that was reportedly sending fighters to Libya. Since Prime Minister Habib Essid took office last month, roughly 400 people have been arrested for ties to terrorist groups, according to Reuters.  

The terrorists responsible for Wednesday's attack may have come from closer to Tunis than the Libyan border, though. “It’s impossible now to go from the Libyan border all the way to the Bardo museum with weapons without getting stopped,” said a Tunisian National Guard officer, speaking to International Business Times on the condition of anonymity, as officers were not authorized to speak on the subject.

The two gunmen killed on scene were identified as Tunisian nationals Jabir al-Khashnawi and Yassin al-Abidi, members of the Okba Ibn Nafaa brigade. At least two accomplices are thought to still be at large. The brigade has ties to both al Qaeda in the Islamic Maghreb and the Islamic State group.

On Monday, the brigade's official social media account said one of its Tunisian members, Ahmed al-Rouissi, who went by the nom de guerre Abu Zakariya al-Tunisi or Abu Uwais al-Tunisi, was killed in Libya. He was reportedly the leader of one of ISIS’ Libya branches .

According to Pieter Van Ostaeyen, an independent analyst who focuses on foreign fighters in militant groups, al-Tunisi’s death may have “triggered a sleeper cell,” but no specific group has yet claimed responsibility for the museum attack. However, the scale, timing and target of Wednesday's shooting suggest that it was planned in advance.

“Propaganda, weakening the government and delegitimizing it,” Pham said. “It’s a perfect trifecta for an extremist group.”