DHAKA, Bangladesh — Seven militants linked to the Islamic State were sentenced to death by a Bangladeshi court on Wednesday for their role in planning a gruesome 2016 attack at an upscale bakery in Dhaka, one of the worst such attacks the country has suffered.

The attack, which left 24 people dead and was initially claimed by the Islamic State, at the time represented one of the clearest indications that the group had made inroads in South Asia.

And after their sentence was handed down on Wednesday, the convicted men vowed to carry out an even bloodier attack.

The violence took place in July 2016 in a diplomatic enclave of Bangladesh, a Muslim-majority country. Militants armed with machetes, grenades and rifles stormed the Holey Artisan Bakery, sorted foreigners from Bangladeshis, and then slaughtered hostages during an 11-hour standoff with the military.