One of the men, Xulhaz Mannan, was a top gay rights activist in Bangladesh and editor of the country's only LGBT magazine. He was also a former employee at the U.S. Embassy in Dhaka.
Mannan and the second victim, identified by Bangladeshi media as Tanay Mojumdar, were both openly gay and served on the staff of Roopbaan, a Bangladeshi magazine and activist group for LGBT rights. Homosexuality is technically illegal in Bangladesh.
U.S. Secretary of State John Kerry condemned the "barbaric" murders in a statement released Monday.
"We are profoundly saddened by the loss of one of our own in such a senseless act of violence, and we extend our deepest condolences to Xulhaz's family and loved ones," Kerry said. "We remain committed to the principles that were so important to Xulhaz, and we promise to support all those who work on behalf of tolerance and human rights in Bangladesh and around the world."
Miley Cyrus also tweeted about the incident overnight, sharing a screenshot of an article about the deaths with the caption "my heart breaks."
Mannan was a "courageous advocate for LGBT rights," State Department spokesman John Kirby said at a briefing on Monday, according to ABC News. "An act like this simply is beyond words, unjustifiable, inexcusable and our heartfelt condolences of course go out to his mother, to his family, to his friends, and to his colleagues, as well as all of those who knew and loved the other individual who was also brutally murdered with him."
Kirby continued: "As we mourn his death we celebrate Xulhaz's life and everything he contributed to Bangladesh, to the United States and to the global struggle for human rights and dignity. And we pledge our support to Bangladeshi authorities to ensure that the cowards who did this are held accountable."
U.S. Ambassador to Bangladesh Marcia Bernicat also spoke out against the perpetrators of the attack.
"We abhor this senseless act of violence and urge the government of Bangladesh in the strongest terms to apprehend the criminals behind these murders," she said in a statement, the BBC reports.
Ansar-al Islam, al-Qaeda's Bangladeshi branch, claimed responsibility for the "blessed attack" in a tweet sent Tuesday.
Mannan and Mojumdar were "pioneers of practicing and promoting homosexuality in Bangladesh," the tweet reads. "They were working day and night to promote homosexuality among the people of this land since 1998 with the help of their masters, the US crusaders and its Indian allies."
According to the Associated Press, the attack was carried out by at least five young men who entered Mannan's apartment building by posing as courier service employees.
"Some people chased the attackers, thinking they were robbers," senior police official Shibli Norman told the AP.
No arrests have been made as of early Tuesday.