British High Commissioner Anwar Choudhury was injured in the attack
A court in north-east Bangladesh has sentenced three men to death for a 2004 grenade attack that killed three people and wounded a British diplomat.
Prosecutors said the men were all members of the banned Islamic militant group Harkat-ul Jihad al-Islami (Huji).
Two others were given life terms by the court in the city of Sylhet.
British High Commissioner Anwar Choudhury was visiting a shrine in the city when the grenade was thrown at him. More than 50 others were hurt.
A British High Commission spokesman in Bangladesh welcomed the completion of the case, but opposed the use of the death penalty
Harkat-ul Jihad al-Islami is one of several banned armed groups seeking to establish hardline Islamic rule in Bangladesh.
One of those sentenced to death was Mufti Abdul Hannan, who is alleged to be the Huji leader.
His brother and another man were also sentenced to be hanged. All three were convicted of charges of murder and use of explosives.
"The judge has said the charges against five [have] been proved beyond doubt. He sentenced three militants, including Harkat-ul Jihad al-Islami leader Mufti Abdul Hannan, to be hanged," police inspector Abdul Ahad Chowdhury said, AFP news agency reports.
Defence lawyers said they planned to appeal.
"Justice has not been delivered," Mufti Hannan told AFP. The agency described him as "visibly shocked".
Anwar Choudhury is a British citizen of Bangladeshi origin whose family come from the Sylhet area.
The 21 May 2004 explosion occurred only weeks after he took up his posting as he made his first visit to his ancestral home.
Mufti Hannan is believed to be a veteran of the war against the Soviet occupation of Afghanistan in the 1980s and 1990s.
Police at the time said the attack was "to avenge the deaths of Muslims in Iraq and across the world by America and Britain".
Mufti Hannan is also charged with planning a grenade attack targeting Awami League leader Sheikh Hasina, which killed 23 people on 21 August 2004.
Bangladesh experienced a series of bomb attacks in 2004 and 2005 which were blamed on Islamist militant groups as part of their campaign to force Sharia law in the mainly Muslim country.
The violence eased after the heads of two powerful militant groups were arrested and executed.