The man believed to have masterminded both attacks, Chamseddine al-Sandi, remains on the run, but there are reports that he was killed in a US air strike in Libya.

Two separate trials were held over the attacks, which Islamic State militants said they had carried out.

Three gunmen – two in the Bardo attack and one in Sousse – were shot dead at the scene.

In the Sousse trial, four militants were given life sentences, while five others were sentenced to between six months and 16 years. A further 17 were acquitted.

Three Bardo defendants also got life terms and a number of others were jailed for shorter periods. At least 10 were acquitted.

A state of emergency has been in place since the attacks.

Tunisia’s already faltering tourism industry was badly hit, but it has shown signs of recovery in the past year with travel bans lifted by several countries, including the UK – as tour operators return.

There has been considerable progress in combating jihadists in Tunisia thanks to concerted international help, BBC Middle East editor Sebastian Usher says.

But they still pose a potent threat, he says, while the endemic problems of chronic unemployment and lack of economic opportunity persist.