Bangladesh Prime Minister Sheikh Hasina pledged to hunt down radical Islamists who stabbed to death a gay rights activist and his friend on Monday.

Hasina said religious extremists, especially those from the Jamaat-e-Islami group, were behind the attack in which the editor of an LGBT magazine was killed.

"Everybody knows who are behind these killings ... The BNP-Jamaat clique has been involved in such secret and heinous murders to destabilize the country," Hasina said, directing the blame on opposition political parties.

Rising religious extremism and the influence of Islamic State-affiliated militant groups in the country are blamed for the increasing attacks on liberal thinkers, secular activists, gay right champions and independent bloggers in Sunni Muslim majority Bangladesh.

Samad, a law student, was one of the organisers of secular campaigning group Ganajagran Manch.

Hardline Islamic militant groups, some of them claiming allegiance to the so-called Islamic State (Isis) were behind the killing of at least four intellectuals in the country last year.

Xulhaz has been running Roopbaan, a magazine and activist group for the Lesbian, Gay, Bisexual and Transgender (LGBT) community in the country. They have been the force behind the campaign for more tolerance to gays in the society. Homosexuality is illegal in Bangladesh and religious radicals have long been vindictive of gays.

Xulhaz and Tanay Mojumdar, who was also killed on Monday, were openly gay. They used to organise the annual "Rainbow Rally" in Dhaka.

"I am devastated by the brutal murder of Xulhaz Mannan and another young Bangladeshi," US Ambassador Marcia Bernicat said.

"We abhor this senseless act of violence and urge the government of Bangladesh in the strongest terms to apprehend the criminals behind these murders," the envoy said, according to the BBC.

Bangladesh's hardline Islamists had drawn up in 2013 a list of 84 people they wanted to eliminate.

Several secular bloggers who campaigned for death penalty for Islamist leaders who were behind the mass killings in post-independence Bangladesh were hacked to death following the publication of the list.