How Sousse attack led to security improvements in Tunisia
When the Sousse terrorist attack took place in June 2015 the Tunisian authorities had almost no effective counter-terrorism capability.
Still coping with the aftermath of the Arab Spring revolt, they had little to no idea who was posting extremist material online, who they were in contact with, nor even who was professing a desire to carry out violent jihad.
Tunisia's shared border with Libya, already by then a haven for extremist Islamist militants, was as porous as a sieve.
A lot has changed since then.
'Training the trainers'
Although Britain initially upset Tunisia by changing its travel advice to warn against all but essential travel to the country, hurting the tourist industry by effectively advising British tourists not to go there, it has put enormous efforts into helping Tunisia improve its security.
Under a scheme run jointly by the Foreign Office and the Home Office, a team of police officers has been deployed from National Counter Terrorism Police headquarters, including specialists in the protection of airports, hotels and resorts and other tourist locations.
Together with a team from France, the British experts have been focussing on aviation security, visiting seven Tunisian airports that have all had direct flight connections to the UK, looking at ways to improve security, notably passenger and cargo screening.
Alongside the French, Britain's policemen have also been "training the trainers", helping Tunisia to set up its own cadre of trainers, teaching them current best practice on how to react to bomb threats or a marauding firearms attack similar to those suffered by Tunisia in 2015.
An overseas training film on how to respond to a terrorist attack is now being distributed, similar to the one issued by the police here entitled "Run, Hide, Tell".
A Whitehall official told the BBC that the aim was to improve the way people respond to an attack, including not just the police and military but hoteliers and other staff at resorts.
Since the Sousse attack Tunisia has built a 125-mile border wall with Libya, known as a "berm", to try to prevent jihadists crossing over from so-called Islamic State and other training camps.
The US and Germany have been the lead advisers here but the UK has provided CCTV equipment and training.
British cyber analysts have also been advising the Tunisian authorities on how to find and take down extremist content online.
Britain's efforts are part of a G7-plus international initiative to help improve Tunisia's security.
It involves all the G7 nations as well as Spain, Belgium, EU, Switzerland and Turkey.
In December 2016 Tunisia's minister of the interior came to London and signed a comprehensive memorandum of understanding with Home Secretary Amber Rudd on counter terrorism and counter extremism.
Foreign Office Minister, Tobias Elwood, said today: "It is in the West's interests to help Tunisia boost its security and we have stood by our friend."
Diplomats point out there has not been a significant terrorist attack in Tunisia in over a year.
Yet no one is being complacent.
It was not until 2013 that the Tunisian authorities even acknowledged they had a security problem, and despite a massive improvement in their capability there remain concerns about porous borders and infiltration by extremists coming from Algeria and southern Libya.
There is also the question of returning IS fighters from Syria and Iraq, an area Britain is advising on.
Tunisia has one of the highest per capita ratios of fighters going off to join IS.
As with Britain, many will now be looking to come home.