DHAKA (Reuters) - A Bangladesh court handed death sentences to seven members of an Islamist militant group on Wednesday for their role in an attack on a cafe 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 prosecutor Golam Sarwar Khan told reporters after the verdict, amid tight security at the court in the capital, Dhaka.

One of the eight accused was acquitted, he added.

A defense lawyer said the convicted men would appeal the charges, which include training the attackers and supplying arms, explosives and funds.

After the ruling, they shouted “Allahu Akbar” (God is Greatest) and “We did nothing wrong” from the dock to a packed courtroom, witnesses said.

Two were seen wearing prayer caps bearing the insignia of Islamic State; authorities opened an investigation into how the caps reached them while they were in police custody.

The July 1 attack on the restaurant popular with foreigners in Dhaka’s diplomatic area shocked the nation of 160 million and unnerved businesses, including the vital garment exports sector, and foreign investors.

Slideshow ( 5 images )

Five young militants, armed with guns, sharp weapons and grenades 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.

Prosecutor Khan said the seven men convicted on Wednesday belong to Jamaat-ul-Mujahideen Bangladesh, a group that seeks to establish sharia rule in the predominantly Muslim country.

“The ruling will set an example. It will give a message to militant groups that none of them will be spared,” Law Minister Anisul Huq said.

Under Prime Minister Sheikh Hasina, Bangladesh has been cracking down on militant groups to preserve its image as a moderate Muslim nation. After the cafe siege, police raided suspected hideouts and killed dozens of militants believed to have helped mount the attack. Hundreds more were arrested.

“We are happy that justice has been served,” said Shamsuzzaman Shams, whose policeman brother was killed when he tried to enter the cafe to foil the attackers, adding: “We want immediate execution of the ruling.”

But defense lawyer Delwar Hossain said all seven men convicted on Wednesday will challenge the verdict in a higher court. “They didn’t get justice,” he said.

Slideshow ( 5 images )

The assault was claimed by Islamic State but the government has consistently denied the presence in the country of any transnational militant organization such as al Qaeda or Islamic State, blaming domestic militants instead.

Police said a faction of Jamaat-ul-Mujahideen Bangladesh, which has pledged allegiance to Islamic State, was involved in organizing the cafe attack.

In the year before the atrocity, Bangladesh saw a string of grisly individual murders, including of secular writers and foreigners, claimed by Islamic State or al Qaeda.

The U.S. embassy in Dhaka said the trial was a landmark case. “We remain committed to continuing to support Bangladesh in its fight against terrorism, especially in our shared efforts to improve rule of law,” it said.