A stream of buses quietly ferried out thousands of guests who abruptly ended their beach holidays in the coastal city of Sousse.
ISIS claimed responsibility for the attack that started on the beach outside the Hotel Riu Imperial Marhaba, but it wasn't clear if the Islamist group had any direct role in it.
ISIS posted a photo of the alleged attacker, whom Tunisian authorities identified as 24-year-old Saif Al-Deen Al Rezgui from the town of Gaafour, about 100 miles northeast of Sousse.
Al Rezgui's uncle and neighbors identified him as the man in the ISIS photo.
His uncle told CNN that Al Rezgui visited his hometown and parents' home Thursday, the day before the attack.
Friday evening, Al Rezgui's mother and father were taken from their home to Tunis as part of the investigation, the uncle said.
Al Rezgui lived in Gaafour until 2011 and later moved to the nearby region of Kairouan to go to college. Police described him as a normal young man who participated in a music group while he lived in Gaafour.
"He used to love soccer," one neighbor said. "Always him and his father, playing in front of the house."
Said another, "He couldn't have done it. It's like some radicals kidnapped his mind."
Al Rezui was not known to have problems in Gaafour and was seen as an introvert who came from a poor family, police said. They added that his younger brother died in 2010 when struck by lightning, a death they believe may have affected Al Rezgui.
Initial reports Friday about the attack suggested there had been three gunmen, but a Tunisian Interior Ministry spokesman later said they were aware of only one and that he had been killed.
The spokesman, Mohammed Ali Aroui, told CNN on Saturday that the gunman specialized in electronics in pursuing his masters degree and didn't have any known relationship with a terror group
He worked in the past for an entertainment organization involved in tourism, which may explain how he knew the hotel layout, Aroui said. It is not yet clear what his current job was, if he had one, the spokesman added.
His first passport was issued in 2013 and there was no sign of foreign travel on it, he said.
Two U.S. officials said they believe the attack may have been inspired by ISIS, though not directed by the terrorist group.
Saturday night, a large crowd of Tunisians turned out at the hotel in a display of unity after the attacks. They chanted and sang, waved the red and white Tunisian flag, and lit candles at the spot where the dozens of victims had been shot the day before.
It started on the beach
The attack lasted about five minutes, starting on the beach, continuing at the pool and in the hotel lobby, and ending when the gunman was killed in the hotel's parking lot, Aroui said.
Tunisian Prime Minister Habib Essid said the gunman hid an AK-47 machine gun under an umbrella to smuggle it onto the beach, which overlooks the Mediterranean Sea.
British tourist Ellie Makin watched him carry it.
"A guy had walked onto the beach and had dropped what I'd seen as an umbrella and underneath (it) was a massive gun of some sort and it was like in the army," she said.
"He was just firing left and right and center. I got up quick as possible ... and shouted, 'Run, there is a gun.'"
A British man wounded in the arm described running into the sea to escape.
"I heard someone firing a gun and then I looked at my wife, and she got up and ran," the man, whose name wasn't given, told Tunisia's Watania 1 TV.
"As I turned, the bullet just hit me in my arm. ... My wife ran to the hotel, and I just saw the gunman firing shots randomly at people laying on the sunbeds on the beach."
Survivor: I was lucky
Speaking to CNN from a hospital bed in Sousse, 76-year-old Ukrainian vacationer Nadezhda Vasilievna said she was lying on the beach reading a newspaper when she heard an explosion.
"My husband went to swim, and I was lying and reading the newspaper by the sea. Suddenly I heard an explosion," she said.
"I saw the man running and shooting. He shot at us. For those who moved, he fired again. I looked where he pointed the gun. When he aimed the weapon in my side, I felt a kick. The bullet went right through my soft tissues."
She said she watched, stunned, as the gunman -- whose appearance she can't recall except that he was dressed in black -- carried on firing.
Those who were standing or sitting, were in the center of the beach, or were closest to the water bore the brunt of the attack, she said.
"I was lucky," Vasilievna said. "I had no fear. It was like a movie. I just watched him and tried to deceive him. I just lost a lot of blood."
After the rampage ended, she was helped to a medical unit in the hotel and then on to the hospital.
Her husband, Igor Vladimirovich, age 78, was swimming at the time and said he watched the attack from the water in disbelief. "The terrorist fired almost without stopping. He moved quickly," he said.
It was the couple's second trip to Tunisia.
Tunisian authorities on Saturday began transferring the bodies from Sousse to the capital, Tunis, the Ministry of Health said. It updated the death toll to 38 and said 39 people were wounded.
"The nationalities of the killed, most of them are British, German, and French, this is the 95% of them," according to Prime Minister Essid. "The majority of them are British, then the second in number were German, then third in numbers were French."
Fifteen of the dozens killed were British, and the number may rise, the UK Foreign Office said.
British Foreign Minister Tobias Ellwood called it "the most significant attack on British people since 7/7," the day in 2005 when suicide bombers struck the London transport network, killing 52 and wounding hundreds.
One Belgian, a German and a woman from Ireland were also among the dead, with the Irish government indicating Saturday that there is also "grave concern for two other Irish citizens who had been at the scene."
The Irish victim, Lorna Carty, was a nurse from County Meath on holiday with her husband, Declan, who was recovering from a recent illness.
She was very involved with the local Gaelic Athletic Association club, acting as a physical therapist and taking a big role in fund-raising, said club chairman Liam O'Farrell. He said she was helping to sell raffle tickets for the club right up to last week, before she went on the trip.
"Lorna was very popular here," he said. "She's been with the club for many, many years. Her own little lad, Simon, started off at under-8s."
Carty's son, Simon, is now a well-known local Gaelic soccer player and a member of the Meath senior county team. He was due to play in an inter-county match Sunday with his family watching, O'Farrell said.
"Lorna would have been so proud tomorrow of Simon, and it's just heartbreaking," he said.
German Chancellor Angela Merkel spoke with Tunisian President Beji Caid Essebsi on Saturday, a German government spokesman said. Merkel expressed her condolences, the spokesman said, and both leaders agreed to cooperate more closely on the issue of terrorism.
In the wake of the resort attack, Essid announced a crackdown on what he called "illegal mosques."
The mosques were "spreading rumors and poisons to encourage terrorism," he said Saturday "About 80 (mosques) will be closed ... within one week."
Attacks also in France, Kuwait
Tunisia's nightmare came the same day as at least two fatal terrorist attacks in other countries.
A man caused an explosion at a chemical plant near Lyon
in southeastern France after having beheaded his boss and leaving the head hanging on a fence, French officials said. Authorities detained the suspect.
Spain raised its terror alert in light of the three attacks, the country's interior minister, Jorge Ferandez, said. Other leaders, like British Prime Minister David Cameron, reacted as well.
"I am sickened by the attacks in Tunisia, France and Kuwait," Cameron tweeted. "Our countries stand together in combating the horrors of terrorism."