Seifeddine Yacoubi Tunisia Isis
Seifeddine Rezgui shot and killed 38 people, mostly Britons, before being killed in Sousse, Tunisia Facebook

Islamic State (Isis)-inspired gunman Seifeddine Rezgui was mostly radicalised over the internet, Tunisian Prime Minister Habib Essid has said, unpacking the range of threats Tunisia faces from extremism both at home and abroad.

Essid claimed a range of factors were likely to have driven the 23 year old to gun down 38 victims, the worst terrorist atrocity in the country's history, but said in an interview with CNN: "I think he was mainly radicalised online."

The Tunisian premier said authorities found Rezgui had not used a passport he held since 2013 to travel abroad either to the Levant, where more than 3,000 Tunisians are believed to be fighting with IS, or to Libya, a common training ground for Tunisian jihadis.

However, just because his passport showed no signs of travel it did not mean a trip to Libya, in particular, could be ruled out.

"But you don't know sometimes they can go abroad especially the circulation between Tunisia and Libya could be done through irregular ways," Essid said.

Isis Libya
Islamic State has been able to take advantage of a power vacuum in Libya SITE Intel

Police sources and one student who knew Rezgui have claimed he trained in Libya, which has become a safe haven for extremists following the ousting of the country's 40-year dictator Muammar Gaddafi.

Libya, which is awash with weapons following the country's liberation war, has become a paramount security concern for Tunisia.

It is believed the weapon Rezgui used in his brutal attack came from Libya. The gunmen involved in Tunisia's last terrorist attack, the Bardo Museum shootings in which 22 people were killed, were also believed to have been trained in Libya.

"We have 520km of borders with Libya. Everything could happen through this border. On the other side you don't have a state, you have groups. It is very important for us, the dangers and the guns from Libya. People are trained and people come back from Libya to Tunisia," Essid said.

It is has emerged that as well as being influenced online and possibly training in Libya, Rezgui also came into contact with radical Islam at university and at a mosque.

A chilling video shows Tunisia gunman, Seifeddine Rezgui, shortly after his deadly rampage on Sousse beach. Twitter

"There is some information that he belonged to some organisation and he was very close to a mosque that trains in at least in the intellectual way for terrorists," Essid said.

Rezgui's father, Hakim, has said his son was cultured and hard-working, and was "brainwashed".

His family claim they were unaware of Rezgui's increasingly radical beliefs, and said his passions were football, rap music and breakdancing.

Essid also commented on the calamitous effect the attacks had on Tunisia's tourism industry. "It is very damaging, it is a heavy damage because the sector is drowning," he said.

"We should do everything to save the situation."