A Tunisian court has sentenced seven extremists to life in prison over attacks at a museum and on a beach in 2015 that left dozens of tourists dead, prosecutors said on Saturday.

Two separate trials were held over the closely linked attacks which occurred just months apart in Tunis and Sousse.

The court also handed down jail terms of between six and 16 years to some of the defendants, said prosecution spokeswoman Sofiene Sliti.

On March 18, 2015, at least 23 people were killed in the Tunisian capital when gunmen armed with Kalashnikov assault rifles attacked the Tunisian capital’s famed Bardo Museum and the parliament compound.

Two gunmen opened fire at tourists as they disembarked their buses on their way to the museum, while dozens of other tourists were held hostage inside the museum.

Just three months later, on June 26, 2015,  23-year-old student Seifeddine Rezgui went on a bloody rampage in a Tunisian beach resort in Port El Kantaoui, shooting 38 foreigners, among them 30 Britons, with a Kalashnikov assault rifle at the five-star Riu Imperial Marhaba hotel.

The attacks’ death toll was the worst loss of life for Britain in an extremist attack since the July 2005 bombings in London.