The activist Xulhaz Mannan, who had started a gay, lesbian, bisexual and transgender magazine, was hacked to death in a machete attack in 2016. DHAKA, Bangladesh — Six men said to belong to an Islamist militant group were convicted and sentenced to death on Tuesday over the 2016 killings of a prominent Bangladeshi gay rights activist and his friend. When Xulhaz Mannan, an activist sometimes referred to as Julhas Mannan, and his friend Mahbub Rabbi Tonoy were hacked to death in April 2016, it was seen as yet another in a series of targeted attacks against academics, secular writers and activists who wrote views critical of Islam. That same month, an atheist blogger was shot and killed, and a university professor was hacked to death. Mr. Mannan’s killing was the first attack on a gay rights activist. “They decided to slay the victims for their involvement in gay rights’ activism,” a special antiterrorism tribunal in Dhaka said on Tuesday in announcing the convictions and sentences. “All the convicts had the same intention. They wanted to prevent them from practicing their freedom and create fear among the other people from expressing their opinion.”