A Bangladesh court has handed death sentences to seven members of an Islamist militant group for plotting an attack on a cafe in 2016 that killed 22 people, mostly foreigners, in the south Asian country’s worst such incident.

“Charges against them were proved beyond any doubt. The court gave them the highest punishment,” the public prosecutor 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 shouted: “Allahu Akbar” (God is greatest), witnesses said.

The attack on 1 July 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 Jamaat-ul-Mujahideen Bangladesh, which seeks to establish sharia rule in the predominantly Muslim country.