Demonstrators face a row a police officers in Tunis, Tuesday, Jan. 26, 2021. AP
Tunisia hands death sentences to convicts mainly in trials related to national security under a 2015 terror law, despite a moratorium on capital punishment in place since 1991.
Friday's verdict concerns the murder of army corporal Said Ghozlani in November 2016, in the Mount Mghila area near the border with Algeria.
He was found beheaded in his home in that region, which is considered a hideout for jihadists.
The Islamic State group claimed responsibility for killing the soldier.
The Tunis court on Friday also sentenced to jail 15 people accused of involvement in the murder, with terms ranging from 32 to 44 years in prison.
Tunisia saw a surge in radical Islamist activity following the ouster of autocratic president Zine El Abidine Ben Ali in the 2011 revolution.
Dozens of members of the security forces have since been killed in jihadist attacks.
The security situation has greatly improved in recent years, but Tunisian forces continue to track down suspected jihadists in the Mount Mghila and Mount Chaami regions.
In 2020, President Kais Saied called into question the moratorium on the death penalty, after the murder of a 29-year-old woman sparked outrage in the country.
Her body had been found in a ditch near the highway linking the capital Tunis to the residential suburb of Marsa.
A man was arrested and confessed to strangling her and stealing her phone.
At the time, Saied said: "Anyone who kills a person for no reason deserves the death penalty," prompting outrage from rights groups.