Parvez Mollah, security guard of the flat of Xulhaz Mannan, was injured during the April 25 assault in Dhaka, Bangladesh, in which Mannan and a friend were hacked to death. (Abir Abdullah/European Pressphoto Agency)

KILLERS ARMED with machetes have been on a rampage in Bangladesh. This year they have slain at least nine people, including secular bloggers and liberal activists. Extremist religious groups accused the bloggers of ridiculing Islam and promoting homosexuality and promiscuity. On April 23, Rezaul Karim Siddique, an English professor at Rajshahi University, was hacked to death. Then, on April 25, according to witnesses, six men wielding guns and machetes forced their way into the home of Xulhaz Mannan, editor of Bangladesh’s only gay rights magazine, Roopbaan, and murdered him and an activist friend.

The bloody assault was a sickening reminder that lesbian, gay, bisexual and transgender rights — the right to live and love as one wishes — are viewed dimly in many nations and societies around the world. While the United States has its own vigorous debates about laws on marriage and protections against discrimination, menacing and regressive attitudes abroad are often enshrined by states and religious leaders who let bigotry and intolerance run riot.

Mr. Mannan, who also worked for the U.S. Agency for International Development, was killed alongside Tanay Mojumdar, also of the magazine, which was set up in 2014 to spread tolerance and raise awareness. The BBC quoted a photographer friend as saying that both men were openly gay and believed that if more gay Bangladeshis came out, the country would have to accept them. Homosexuality is criminalized in Bangladesh.

Discrimination, violence and hostility to LGBT populations flourish elsewhere, too. A decade ago, according to a global survey, 92 countries criminalized same-sex sexual acts between consenting adults. As of 2015, the number had fallen to 75 countries, but that’s still more than a third of United Nations member states. Uzbekistan punishes homosexual acts by prison terms of up to three years, and its president, Islam Karimov, this year called homosexuality part of Western “vulgar” culture. In Indonesia, a parliamentary committee has suggested censoring media content about the LGBT community. In Morocco on March 9, two gay men were dragged from a house, cursed and bloodied by attackers, and then the injured men were put on trial for homosexuality. One has been convicted and sentenced to four months in prison, according to Human Rights Watch.

Much of the bigotry is deliberately inflamed by dictators, from Russia to Uganda, who create and exploit divisions to distract from their own corruption and poor governance. In recent years, a disturbing new trend has cropped up in which governments attempt to go after speech about gay rights, such as the vaguely worded 2013 law in Russia that banned the spread of media or Internet material about “nontraditional sexual relations” to minors. In China, homosexuality was decriminalized in 1997, but there are still deep stigmas, and, in the first legal test, same-sex marriage was recently rejected by a provincial court.

On so many levels, the killings in Bangladesh sound an alarm. Millions of LGBT people suffer from ignorance and prejudice, and their governments and societies enable the violence and pain.