Image copyright Getty Images Image caption Eight people were put on trial accused of supplying weapons to the attackers

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

The attack on the Holey Artisan cafe in Dhaka was carried out by a group of five men, who took diners hostage.

Eight people were on trial, accused of planning the attack and supplying weapons. One man was acquitted.

The 12-hour siege was Bangladesh's deadliest Islamist attack. Most of the victims were Italian or Japanese.

The attack was claimed by the Islamic State (IS) group, but Bangladesh disputed this, instead holding a local militant group responsible. All of the gunmen were killed by police.

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

Public prosecutor Golam Sarwar Khan, speaking after the verdict was delivered, said the charges against the accused "were proved beyond any doubt".

"The court gave them the highest punishment," the prosecutor told reporters.

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

The wife of Robiul Islam, a policeman killed in the attack, said she hoped the death sentence would be carried out as soon as possible.

"In our society, it is really difficult for a widow to live with two kids. But I'll consider myself lucky because I've been showered with respect and support. My husband died for his country and is considered a martyr," Umme Salma told BBC Bengali.

Media playback is unsupported on your device Media caption Inside Bangladesh terror attack cafe

The seven convicted men were accused of belonging to Jamaat-ul-Mujahideen Bangladesh (JMB), a home-grown Islamist group outlawed in the country.

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

Some of the men shouted "Allahu Akbar" (an Arabic phrase meaning "God is greatest") as they were led away from the packed courtroom, AFP news agency reported.

A security cordon was put in place outside the court, with hundreds of armed police officers surrounding the building.

One of the suspected masterminds of the attack, Nurul Islam Marzan, was killed in a shootout with anti-terrorism police in January 2017, authorities said.

How did the attack happen?

On the evening of 1 July 2016, five gunmen burst into the Holey Artisan cafe in the upmarket Gulshan district of Dhaka.

Armed with assault rifles and machetes, the young attackers opened fire and took diners hostage at gun-point.

The attack saw victims inside the cafe, most of whom were foreigners, shot or hacked to death by the militants.

Media playback is unsupported on your device Media caption A Dhaka resident captured the sound of gunshots during the raid in 2016

Army commandos were called in after two police officers died trying to fight the militants.

After a 12-hour stand-off, the commandos stormed the building and rescued 13 hostages, killing all five militants behind the attack.

The casualties included nine Italians, seven Japanese, an American and an Indian. Family members and friends of the victims had gathered in the vicinity, anxiously waiting for news.

Image copyright Getty Images Image caption The former location of Holey Artisan cafe, pictured here on the one year anniversary of the cafe attack

Bangladesh Army Brig Gen Naim Asraf Chowdhury said the victims had been "brutally" attacked with sharp weapons.

"It was an extremely heinous act," Prime Minister Sheikh Hasina said in a televised address at the time. "What kind of Muslims are these people? They don't have any religion."

A police investigation found 21 militants in total were involved in carrying out and planning the attack, the Daily Star newspaper reported. Five were killed during the attack, eight in later anti-militant operations, the paper said.

How did the authorities respond?

At least 80 suspected militants were killed and more than 300 people arrested during a wave of operations that followed the attack.

Before that there had been a string of deadly attacks on secular writers, bloggers and members of religious minorities.

The Bangladeshi government repeatedly denied international jihadist groups, such as IS and al-Qaeda, were behind these attacks, usually blaming the JMB instead.

Image copyright Getty Images Image caption Bangladeshi authorities have led a brutal crackdown on militants since the attack

But security forces were subjected to intense criticism for failing to prevent the violence. The Holey Artisan cafe attack - claimed by IS - galvanised the country's security agencies into action.

However there have been persistent worries over the authorities' tactics.

The UN and others have accused the security forces of enforced disappearances, extra-judicial killings and use of torture.

Islamist militant groups not yet uprooted

Analysis by Akbar Hossain, BBC Bengali, Dhaka

The Holey Artisan cafe attack prompted massive anti-terror operations across the country. And there were huge human rights concerns over how the operations were conducted.

The government claims it dismantled Islamist militant groups. The security forces and spy agencies in Bangladesh purchased sophisticated equipment to track militant activities over the internet.

Security analysts recognise the government has successfully contained militancy - but it's not thought to have been completely uprooted.

A recent picture released by the Islamic State group showed several young Bangladeshis expressing their support for the extremists' new leadership after US forces killed its former leader, Abu Bakr al-Baghdadi.