Attackers armed with machetes have killed another blogger in Bangladesh, the fourth killing of an online critic of religious extremism in the Muslim-majority country in less than six months.

Niloy Chakrabarti, 40, a blogger who advocated secularism and published under the name Niloy Neel, was killed in his flat in the capital, Dhaka, police official Mustafizur Rahman said.

Police confirmed the 30-year-old had been murdered by a group of four people who had pretended they were looking for somewhere to rent.

"They entered his room in the fifth floor and shoved his wife aside and then hacked him to death. He was a listed target of the Islamist militants," Imran Sarker, head of a network of activists and bloggers, said.

"We are speechless. He was demanding justice for killing of other bloggers.

"Who will be next for demanding justice for Niloy?"

Deputy police commissioner Muntashirul Islam said Mr Chakrabarti's wife, Asha Moni, had been "confined to another room" during the attack.

Ms Moni told reporters that during the incident one of the attackers was shouting "Allahu Akbar [God is great]".

She said she pleaded with the assailants not to kill her husband but they dragged her to a veranda and confined her there, according to online newspaper bdnews24.com.

Al Qaeda affiliate warns of further attacks

The Bangladesh branch of Al Qaeda in the Indian Subcontinent (AQIS), Ansar al-Islam, claimed the killing and warned of more to come, according to monitoring group SITE.

"If your freedom of speech maintains no limits, then widen your chests for freedom of our machetes," the group, which also claimed to have murdered secular blogger Washiqur Rahman in March, said in posts on Twitter and Facebook.

Mr Chakrabarti was a critic of religious extremism that led to bombings in mosques and the killing of numerous civilians, Mr Sarker said.

He was also one of hundreds of bloggers driving a movement demanding the death penalty for Islamist leaders accused of atrocities in Bangladesh's 1971 war of independence.

Police said Mr Chakrabarti had been one of the organisers of large-scale protests in 2013 against Islamists convicted of war crimes during the conflict.

Bloggers go into hiding

Militants have targeted secularist writers in Bangladesh in recent years while the government has tried to crack down on hardline Islamist groups seeking to make the South Asian nation of 160 million a sharia-based state.

Another secular blogger, Ananta Bijoy Das, was attacked by machete-wielding attackers and killed in the north-eastern district of Sylhet on May 12.

In a Facebook post on May 15, Mr Chakrabarti said he had been followed by two young men after protesting Das's murder, but police refused to register the complaint and instead told him to leave the country.

Most secular bloggers have gone into hiding, often using pseudonyms in their posts. At least seven have fled abroad, according to Canada-based atheist blogger Farid Ahmed, who helped several of them.

Since the airing of the gut-wrenching documentary Leaving Neverland, many of us have wrestled with an uncomfortable, yet essential question: given everything we know, can we continue listening to Michael Jackson's music?