Pressure mounted on Bangladesh Tuesday after two leading gay rights activists were hacked to death, the latest in a series of chilling attacks on intellectuals, writers and religious minorities for which only a handful of people have been convicted.

At least six men carrying machetes and guns entered an apartment building in Dhaka on Monday night and killed Xulhaz Mannan, editor of a magazine for the lesbian, gay, bisexual and transgender (LGBT) community, and fellow activist Mahbub Tonoy.

Rights groups said the latest killings and the murder on Saturday of a liberal university professor appeared to show the attackers were expanding their range of targets. They demanded justice and greater protection for minority groups in the conservative Muslim-majority nation.

"The brutal killing today of an editor of an LGBTI publication and his friend, days after a university professor was hacked to death, underscores the appalling lack of protection being afforded to a range of peaceful activists in the country," said Amnesty International's South Asia director Champa Patel.

LGBTI is an extended initialism for the group, including people who are intersex.

"While the Bangladeshi authorities have failed to bring these violent groups to justice, the attackers have expanded their range of targets to now include a university professor and LGBTI activists."

Al-Qaeda in the Indian Subcontinent (AQIS) on Tuesday claimed responsibility for the murders, saying the two men had worked to "promote homosexuality" in Bangladesh.

"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," said the group's Bangladesh arm Ansar al-Islam in a statement issued on Twitter.

However national police chief A.K.M. Shahidul Hoque told reporters the killing of Mannan, 35, and 25-year-old Tonoy bore the hallmarks of local Islamists.

"The character of the murders is similar to the previous blogger killings. Therefore, it might have been done by the same group," Hoque said.

Story continues

The attack had been "planned extensively" and the victims were followed for days, he added.

US Secretary of State John Kerry condemned the killings of Tonoy and Mannan, who worked for the US government aid organisation USAID. Both had received threats from Islamists over their championing of gay rights.

"Deplore brutal murder of @USAID local staff member and another Bangladeshi advocate in Dhaka. Those responsible must be brought to justice," Kerry tweeted.

- Creating fear and hatred -

In the last month alone, four people have been murdered in Bangladesh for their liberal or secular views, among them a 26-year-old online activist known for his anti-Islamist opinions.

Last year four secular bloggers and a publisher were hacked to death. A number of Christians, Hindus and Sufi, Ahmadi and Shiite Muslims have also been killed since last year in the officially secular but mainly Sunni Muslim country.

No one has yet been convicted over those deaths despite a number of arrests.

Last year a court sentenced two students to death for the 2013 murder of Ahmed Rajib Haider, the first of a string of attacks targeting secular writers.

Another six people were convicted on lesser charges related to Haider's death.

The Islamic State group has claimed a number of the killings, most recently that of a professor hacked to death in the northwestern city of Rajshahi.

Ansar al-Islam has also said it was behind the murders of secular bloggers and writers.

But the Bangladeshi government rejects those claims.

Prime Minister Sheikh Hasina on Monday blamed the main opposition Bangladesh Nationalist Party (BNP) and its Islamist ally, Jamaat-e-Islami for the deaths of the two gay activists and accused the groups of trying to destabilise the country.

"The BNP-Jamaat nexus has been engaged in such secret and heinous murders in various forms to destabilise the country," Hasina said.

"Such killings are being staged in a planned way."

Bangladeshi media criticised the government's claims, saying it had a duty to protect minorities whoever was behind the attacks.

"It doesn't matter whether they are from transnational terrorist groups like IS as they have claimed, or part of locally based militant networks, as the government argues," said the Dhaka Tribune daily in an editorial.

Activist Mannan's magazine, Roopbaan, was launched two years ago and has become a platform for promoting the rights of LGBT people in Bangladesh, where homosexual acts are illegal.

The group's annual Rainbow Rally held on April 14, Bengali new year, was cancelled this year as part of widespread security measures imposed by police.

Ahead of the planned rally, Mannan told AFP that Islamists had posted death threats online.