DHAKA, Bangladesh — In an apparently unprecedented ruling, 152 former members of the Bangladesh Rifles, a paramilitary border security force, were sentenced to death on Tuesday in connection with a bloody 2009 mutiny in which several thousand troops took control of their headquarters, demanding better working conditions, and killed scores of people.

Some of the border guards broke down in tears after hearing their sentence, pronounced by Judge Mohammad Akhtaruzzaman in a crowded Dhaka courtroom under heavy security, and others shouted at the judge, saying the verdict was unfair.

“Allah will deliver justice of this injustice,” they said.

Judge Akhtaruzzaman said the testimony of some witnesses who described the blood bath was hair-raising. “The slain people were not merely killed,” he said. “The dead bodies did not get the respect they deserve according to the law.”

The mutiny began suddenly, at an annual conference of the border force, as a number of guards took their commanders, officers of the Bangladeshi Army, hostage. As soldiers massed around the building, the border guards announced a list of demands, among them better pay, permission to participate in lucrative United Nations peacekeeping missions, and changes in the force’s command and control structure.