TUNIS, Tunisia — The blood on the sand has washed away, but the damage inflicted on Tunisia by a few terrifying minutes of gunfire at a beach resort will be deep and lasting.
The tourism industry, the lifeline for the north African country's economy, is likely to be gutted after 38 tourists were killed in the June 26 rampage in Sousse. Up to 2 million hotel nights are expected to be lost over the next year, hastened by warnings from Britain and other European governments last week that their citizens are no longer safe on Tunisia's shores.
And Tunisia's budding democracy — the only one to emerge from an Arab Spring uprising — is now facing its toughest test. Failure to secure the country against Islamic extremism while protecting newly won freedoms would echo across the region.
A big part of the government's challenge will be containing the economic fallout of the tourist exodus, and social unrest that might result from mass job losses in the travel industry.
"This is their livelihood. It's not just affecting us Britons coming back home. It's affecting the whole of Tunisia itself," said Scottish tourist Darren Blackery, drinking a beer near a pool in the resort of Hammamet and lamenting his government's warning to leave the country. "They need to earn a living and without us, it's very hard for them."
The Medina Belisaire Thalasso Hotel where Blackery stayed can hold up to 552 clients and is usually full at this time of the year, managers say.
On Friday, there were only 31 clients. On Sunday, the last British tourists were leaving — and only 15 customers will remain. In the two weeks since the beach attack, 1,155 people have canceled their bookings.
Similar stories are told up and down Tunisia's Mediterranean shore, as resort entertainers seek work elsewhere and hotel managers ponder whether and when to close down.
Twenty-three hotels have already shuttered since the Sousse attack, said Radhouane Ben Salah, president of the Tunisian Hotel Federation.
"There are practically no European markets left," he said. "The picture is almost black."
Camel guide Faycal Mihoub whisked a tourist group to safety during the Sousse attack, harboring some in his boss' house. Passionate about his work and about the tourists he calls "family," Mihoub knows only his beach livelihood. Some tourists have been coming for 40 years to the sands of the Port El-Kantaoui district of Sousse — since even before the 34-year-old Mihoub was born.
Now they may no longer return.
Nicknamed "Bob," Mihoub is normally able to save about 2,500 dinars ($1,300) after working nonstop through the summer. That's usually enough for him to live through the winter.
This year, he barely worked one month before the Sousse attack threw his future employment into doubt. The area's economy is focused on beach resorts. "For work, we never get anything in Tunisia during the winter," he said. "It's a touristic place, so nothing."
Tourism employed about 400,000 people in this country of 10 million and made up about 7 percent of gross domestic product in 2014. The industry had already begun suffering after an attack on Tunisia's leading museum in March that left 22 dead, mostly foreign tourists.
The government's investment minister warned the country will struggle to pay its international debts as tourism revenues plunge. Tunisia is expected to finish the year 49 billion dinars ($25 billion) in debt, and the Central Bank says overall growth will drop to 1.7 percent this year, down from 2.4 percent last year.
Frustration at unemployment and corruption drove the original protests that led Tunisia to knock down a dictator in 2011, thereby inspiring revolutionary movements from Egypt to Syria. The frustration has continued to simmer.
And now, there is the Islamic State factor. The group has claimed responsibility for the beach attack by student Seifidinne Rezgui, who was killed by police.
Tunisia has seen a larger share of its population join the extremists in Syria and Iraq than any other country — primarily youth from disadvantaged provinces alienated by a messy democratic system that they feel isn't addressing their concerns.
The country's leadership is in a tight spot. The president came under criticism from rights groups for declaring a state of emergency on July 4 that gives the government greater police powers — but then five days later, Britain said Tunisia wasn't doing enough to secure the country.
Frustrated Tunisian government officials said they were trying to respect democratic freedoms instead of carrying out authoritarian crackdowns. Critics, however, say the Tunisian government was slow to grasp the gravity of the problem.
Tunisia's president blames his country's problems on poor security in neighboring Libya, and a lack of international resolve in targeting IS.
Some in Britain have also criticized the government for telling tourists to get out, pointing out that an attack in the U.K. is also considered "highly likely," according to a government threat assessment.
Foreign Secretary Philip Hammond has said that British officials would work with Tunisia on improving security and hoped to downgrade the travel advice "in the not too distant future."
While most European tourists appear to be abandoning Tunisia, a few are showing solidarity with the country whose revolution surprised the world and whose path to democracy remains an inspiration to many.
"The tour operator asked us regarding our stay whether we would change or not. I know that a lot of people in the U.K. canceled. We thought about it and we decided to go ahead and come," Scottish tourist Graeme Pringle said.
"Terrorism is all over the world and wherever we go, to feel 100 percent safe is not achievable."
Angela Charlton reported from Paris. Bouazza ben Bouazza in Tunis, Elaine Ganley in Paris, and Jill Lawless in London contributed to this report.