The militants were on trial over two attacks that took place in 2015. Among those who were facing trial were six security personnel accused of failing to provide assistance to people in danger during the Sousse attack.
A Tunisian court has sentenced seven militants to life in prison over attacks at a museum and on a beach in 2015 that killed 60 people, many of them tourists, prosecutors said Saturday.
Dozens of defendants faced two separate trials over the closely linked shootings, which occurred just months apart in Tunis and Sousse, but many were acquitted.
Three were given life sentences for homicide over the first attack in March 2015 at the capital's Bardo museum, in which two gunmen killed 21 foreign tourists and a Tunisian security guard.
Four received the same term for the shooting rampage at a Sousse tourist resort in June that year, which killed 38 people, mostly British tourists.
Other defendants were sentenced to between six and 16 years, said prosecution spokesman Sofiene Sliti on Saturday.
Prosecutors said afterwards that they planned to launch appeals in both cases.
The court heard that the two attacks, both claimed by Daesh, were closely linked.
Several defendants pointed to the fugitive Chamseddine Sandi as the mastermind of both.
According to Tunisian media, Sandi was killed in a US air strike in neighbouring Libya in February 2016, although there has been no confirmation.
'Duty to IS'
Among those who were facing trial were six security personnel accused of failing to provide assistance to people in danger during the Sousse attack.
That shooting was carried out by Seifeddine Rezgui, who opened fire on a beach before rampaging into a high-end hotel, where he continued to fire a Kalashnikov and throw grenades until being shot dead by police.
Four French nationals, four Italians, three Japanese and two Spaniards were among those killed in the Bardo attack, before the two gunmen themselves, armed with Kalashnikov assault rifles, were shot dead.
Investigations showed one of the gunmen, Yassine Laabidi -- who was born in 1990 and was from a poor district near Tunis -- had amphetamines in his body.
His fellow attacker Jaber Khachnaoui, born in 1994 and from Tunisia's deprived Kasserine region, had travelled to Syria in December 2014 via Libya.
One suspect questioned in court, Tunis labourer Mahmoud Kechouri, said he had helped plan the Bardo attack, including preparing mobile phones for Sandi, a neighbour and longtime friend.
Kechouri, 33, said he was driven by a "duty to participate in the emergence of the (IS) caliphate".
Other defendants accused of helping prepare the attack said they had only discussed ideas with friends. Several alleged they were tortured in detention.
'Finally recognised victims'
Victims' family members in France and Belgium watched the Sousse attack hearing via a live video feed.
"It was important for us to see, and especially to hear -- to try to understand the role" of each defendant, said one French survivor.
"Arriving at the end of the process will help us to turn the page, even if we can never forget."
"The trial allowed them -- by organising the video conferencing and giving the floor to lawyers chosen by the victims -- to finally be recognised as victims by the Tunisian state," said Gerard Chemla, a lawyer for the French victims.
But he lamented that the families of those killed had not been compensated.
The Sousse attack, which killed 30 Britons, is also the subject of proceedings in front of the Royal Courts of Justice in London, which is seeking to establish what happened.
Since a 2011 uprising that toppled dictator Zine El Abidine Ben Ali, militant attacks in Tunisia have killed dozens of members of the security forces.
As well as leaving many dead, the Bardo and Sousse attacks dealt a devastating blow to Tunisia's vital tourism sector -- although it has begun to recover.