Seven Islamists have been sentenced to death for a 2016 attack on a cafe in Dhaka, the Bangladeshi capital in which 22 people, mostly foreigners were killed.

The attack on the Holey Artisan cafe on July 1, 2016 was carried out by five gunmen. Armed with assault rifles and machetes, the young attackers opened fire and took diners hostage at gun-point.

One of the eight people who were on trial for allegedly planning and supplying the attackers with weapons was however acquitted.

The 12-hour siege was claimed by the Islamic State (IS) group but Bangladesh disputed this, holding a local militant group responsible instead.

Since the attack, Bangladesh authorities have led a brutal crackdown on militants who it sees as a destabilizing force in the predominantly Muslim country.

Sentencing the men in Dhaka on Wednesday, a judge said they wanted to undermine public safety and create anarchy.

Public prosecutor, Golam Sarwar Khan while speaking after the verdict was delivered said the charges against the accused were proved beyond any doubt, adding that the court gave them the highest punishment.

A defence lawyer however said the seven men would appeal the death sentences which in Bangladesh are carried out by hanging.

The seven convicted men were accused of belonging to Jamaat-ul-Mujahideen Bangladesh (JMB), an outlawed group.