The accused are said to be members of Jamaatul Mujahideen Bangladesh and were found responsible by the court for planning the attack that killed at least 22 people, including 18 foreigners.
A Bangladesh court on Wednesday handed death sentences to seven members of a militant group for plotting an attack on Holey Artisan Bakery in 2016 that killed 22 people, mostly foreigners, in the south Asian nation's worst-such incident.
"Charges against them were proved beyond any doubt. The court gave them the highest punishment," public persecutor Golam Sarwar Khan told reporters after the verdict in the capital, Dhaka, amid tight security.
One of the eight people accused was acquitted, he added.
After the ruling, the accused men in the dock in a packed courtroom looked defiant and shouted, "Allahu Akbar" (God is Greatest), witnesses said.
The full verdict was not immediately available on Wednesday, but the judge said the men acted against the sovereignty of the country and its constitution in executing the plan for such a big attack in which foreigners had been targeted and killed.
The defendants, who have maintained their innocence, can appeal the verdict.
The July 1 attack on the restaurant popular with foreigners in Dhaka's diplomatic area shocked the nation of 160 million and signalled a chilling threat to business, including the vital garment exports sector.
Five militants stormed the Holey Artisan cafe, took diners hostage and killed them over 12 hours. Nine Italians, seven Japanese, an American and an Indian were among the dead. The attackers were also killed in a rescue bid by army commandos.
Khan said the seven men convicted on Wednesday were involved in planning the attack.
They belong to the group, Jamaatul Mujahideen Bangladesh, that seeks to establish sharia rule in the predominantly Muslim country.
Daesh had claimed responsibility for the attack, but the government of Prime Minister Sheikh Hasina rejected it, saying the domestic group was behind it and that the international group has no presence in the country.