The British government’s tolerance of Islamist hate preachers exporting violence from London in the 1990s may have come back to haunt it. Court papers reveal the gunman who murdered 36 tourists – mostly Britons – on a Tunisian beach has been linked to radical preachers who operated with impunity in the capital over that period.

It is thought that the Tunisian group Ansar al-Sharia radicalized the beach murderer, Seifeddine Rezgui, whose leader and founder, Seifallah Ben Hassine, was mentored by the infamous Abu Qatada in London.

Rezgui’s was studying in Kairouan, 35 miles inland from Sousse where the killed spree occurred, when he embraced radical Islam. The town is a hot bed of terrorism and the home the Ansar al-Sharia group.

Its leader, Ben Hassine, 49, fled Tunisia and arrived in Britain in the late 1990s. It’s not known if he applied for asylum seeker status, but he spent three years in the UK and promptly became a follower of Qatada, who himself had fled Jordan.

Court papers uncovered by the Daily Mail record that Ben Hassine used London as a base when setting up and then running the “Tunisian Fighting Group” from 2000 onwards, who were thought to have links to Al Qaeda.

According to the papers, they “aimed to recruit new members and send them to Afghanistan for training,” adding, “Abu Qatada appears as a watermark running through the whole of this case as being the mastermind.”

Ben Hassine left the UK in 2011, spent time in Afghanistan and then returned to Tunisia to set up Ansar al-Sharia, capitalizing on the chaos that followed the beginning of the so-called Arab spring.

Qatada infamously stayed on and on, in the UK thanks to his “human rights,” only to be deported in 2013. However the two remained in close contact. In January last year Qatada wrote in a letter which was published online: “[Ben Hassine] is among the best of those I have known in intellect,” and “the most knowledgeable of people of my intentions… for he was the closest of people to me.”

Throughout the 1990s the UK government was focused on defeating Irish republican terrorism and did not perceive Islamic fascism as a threat. Islamist preachers were given free rein in UK so long as they only export their violence abroad, earning the city the name “Londonistan.”

The term was coined by the French intelligence services in 1995 after observing what a prolific exporter of terrorism the city had become – particularly pertaining to the 1995 Paris Métro bombing.

By 2005 Britain was even under pressure from leader of the Muslim world, such as President Musharraf of Pakistan, to “get its house in order.” The UK was offering groups such as Al-Muhajiroun and Hizb’ut Tahrir (still legal) a safe haven; groups who had targeted president Musharraf.

The Saudi Arabia Ambassador to London, Prince Turki al-Faisal, called it a “true criticism” of the UK that Islamist could stay and preach violence with no fear of arrest or deportation. He said: “Allowing them to go on using the hospitality and the generosity of the British people to emanate from here such calls for killing and such, I think is wrong.”