A former Tunisian extremist has warned the country could face more terror attacks, from radicals returning from Iraq, Syria and Libya.

Islamic State and other extremist groups are losing territory in those countries where thousands of Tunisians went to fight.

The greatest concern for the authorities is the turmoil in Libya.

The chaos from that broken state has already spilt over Tunisia's borders and intelligence officials fear it could get worse if the civil war in Libya is not brought to an end.

Tunisian police response to Sousse attack was 'cowardly'

:: Tunisia beach attack: Victims' families to sue travel firm


Last year in March, the border town of Ben Gardane erupted in gunfire as IS militants tried to take control.

Tunisia's security forces managed to contain the threat but it was a worrying development.

Many of the extremists had been trained in Libya.

Image: Tunisia's famous souks are struggling as the economy suffers

One of them is former jihadi, Abu Mohammed, who was trained there in 2012 by al Qaeda-linked group Ansar Sharia, along with 13 other Tunisians.

But he's now returned home and said the violent salafist groups are always waiting for the right conditions to carry out terror attacks.

He spoke to Sky News on condition of anonymity.

Documentary: Terror in Tunisia

He said: "There were lots of specialities but I was trained on the Steyr (gun). How to dismantle and assemble it. We studied, we were organised, we prayed, we ate, we trained.

"At that time there was a group preparing to carry out a suicide operation. They told us that democracy doesn't belong to us.

"We shouldn't follow this path."

The security forces are scrambling to contain the Islamist threat which is destabilising the country.

Families: Level of security in Sousse was 'shocking'

In the massacre at the Bardo museum in Tunis and the beach in Sousse, 57 mostly European holidaymakers were gunned down.

With Italy just 62 miles away across the Mediterranean, Tunisia's problems are also a danger to the continent.

Image: Berlin attacker Anis Amri filmed a video pledging allegiance to IS

Anis Amri, who swore allegiance to IS before driving a truck into a crowd at a Christmas market in Berlin murdering 12 people, arrived in Italy seeking asylum in 2011.

His brother, Abdel Kader Amiri, said difficulties in Tunisia made him susceptible to radicalisation.

"I blame my brother first and then the state and the associations which are responsible.

"This is who I blame.

"Because if the state was curing the social issues, I mean go back to the social issues which resulted in terrorism, it would have found a solution.

"Now I'm the brother of a terrorist.

"I'm called the brother of a terrorist. Since I'm called this why is the state not afraid I'll join?" he asked.

Image: Abdel Kader Amiri is the brother of Berlin truck bomber Anis Amri

Tunisia is the lone success story from the Arab Spring but it is vulnerable.

It has become a democracy, but terrorism is damaging the economy and the normally thriving souks and markets are struggling.

In this economic depression, the Islamic extremists find fertile ground for their hateful message.

Security is being increased in the face of the terror threat across the country.

However balancing the new freedoms of a nascent democracy - which were won in the revolution - with an increasingly authoritarian crackdown on the Islamic extremists will not be easy.