TUNIS, Tunisia -- The student who massacred tourists in a Tunisian seaside resort trained in a jihadi camp in Libya at the same time as the two men who attacked a leading museum in March, a top security official said Tuesday, enforcing the notion of a link between the two assaults and raising fears of more attacks from an underground world clawing at this North African nation's budding democracy.
Investigators were searching nationwide for accomplices in the attack that killed 38 tourists and questioning a handful recently detained.
"It has been confirmed that the attacker trained in Libya with weapons at the same period as the Bardo attackers," said Rafik Chelli, the secretary of state for the Interior Ministry. "He crossed the borders secretly."
Chelli said Seifeddine Rezgui, a 24-year-old who obtained a Master degree in electrical engineering, left his studies at Kairouan University and sneaked into the western Libyan town of Sabratha in January -- when the two young men who carried out the museum attack in Tunis were there.
Sabratha, the site of Roman ruins, is one of several places in chaotic Libya where radical groups have training camps. The Islamic State, which has a strong Libyan presence, claimed responsibility for the beach resort attack.
There has been no previous indication that Rezgui had left Tunisia.
Rezgui has been portrayed as a good student. He received his one-year Masters degree, at one point liked break dancing and even getting a certificate, and practicing Kung Fu, according to a person with knowledge of the investigation. The person was not authorized to speak publicly and asked not to be identified.
A fellow student in Kairouan, Saidi Fedi, 25, described him as a model of magnanimity -- but a member of the student branch of Ansar al Sharia, an Islamist group,
"Seif participated in the meetings ... on a lower level. He was not one of the leaders," Feidi said in an interview, referring to the university's Islamic Youth group.
"He was the least radical of the group in which he was active. He was one who took part in the debates, and he accepted different views. He didn't argue aggressively," Feidi said. "He didn't answer with anger" when debating with students who supported the Syrian government. "He didn't do anything that could give us a clue."
The head of post-graduate Institute for Applied Sciences and Technology, attended by the attacker expressed equal shock.
"We informed the police so they could be sure of his identity and personal data," said Karim Ben Elgharat. "We didn't see anything strange about him. He was a good and assiduous student."
The invisibility of the attacker, like those who carried out the Bardo attack, is for Tunisia and elsewhere, the biggest challenge in preventing terrorism.
The spokesman for the Interior Ministry, Mohamed Ali Aroui, said it was not immediately clear whether Rezgui trained in the same group as the Bardo attackers or whether they were linked to the Islamic State organization.
But the presence of radical groups in Libya increases the threat level to its Tunisian neighbour, as does the approaching end of the Muslim holy month of Ramadan and its "night of destiny," which falls in mid-July this year.
It is a night that holds risks, said the person with knowledge of the investigation.
The "night of destiny" is considered a propitious time for good actions, which for jihadis means killings, said Mathieu Guidere, an Islamic scholar at the University of Toulouse.
Tunisia has struggled since its 2011 revolution to maintain the fragile democracy it has managed to put in place -- the only one to emerge from the Arab Spring uprisings. At the same time, it is has seen the highest number of its citizens, some 3,000, head to Syria and Iraq to fight with radical jihadi groups, including the Islamic State group. They usually travel via Libya, getting training on the way. Increasingly, they have trained there before returning to carry out attacks in Tunisia. Tunisia's most well-known Islamic radical Seifallah Ben Hassine, fled to Libya in 2013 taking many supporters with him into exile.
Guidere, who tracks Islamist groups, cited the Soldiers of the Caliphate of Tunisia, a recent group linked to the Islamic State group, as the most likely suspect behind the Sousse attack. It claimed responsibility for the Bardo Museum attack. The small group, he said, is made up of some of the 400 to 500 returnees from Syria and Iraq.
There has been criticism of the government's handling of security, especially since tourists had clearly become a target after the museum attackers killed 22 people in March.
President Beji Caid Essebsi revealed Tuesday morning that heightened security measures had been scheduled to be put in place just days after the beach attack.
"It is not a perfect system -- it is true we were surprised by this affair," he told France's Europe 1 radio. "They took measures for the month of Ramadan but they never thought the attack would be on the beaches against tourists and the system of protection was set to start July 1."
Armed tourist police are to be stationed at hotels and army reservists called up in a bid to staunch damage to the vital tourism industry -- a lifeline for the Sousse region.
At least 25 of the victims were British in the approximately half-hour rampage from the beach through the hotel, according to the latest figures from Tunisia's Ministry of Health. The ministry said 33 of the 38 victims have now been identified, also including 3 Irish, 2 Germans, a Belgian, a Portuguese and a Russian.
The fury of the attack was evident days later. A trail of blood from escaping tourists ran along the sidewalk to the gate of a hotel down the road. The caked pool of blood where the attacker was gunned down near a bend in the road was intact and the white walls lining the street were pocked with bullets.
Friday's attack was not the first in a hotel in Sousse. Two years ago, a gunman with a suicide belt strapped around him assaulted a beach hotel in the downtown area, but killed only himself.
Rosa reported from Kairouan. Elaine Ganley contributed to this story from Paris. Paul Schemm contributed from Rabat, Morocco