(CNN) Prominent Bangladeshi-American blogger Avijit Roy began one of his final articles by writing that January's Charlie Hebdo massacre in France was "a tragic atrocity committed by soldiers of the so-called religion of peace."

He recalled the case of another secular blogger, Ahmed Rajib Haider, who was hacked to death outside his home in Bangladesh in February 2013 by assailants with machetes.

"The virus of faith was the weapon that made these atrocities possible," Roy wrote in the article, which is to be published in Free Inquiry magazine in April

On Thursday night, the engineer and writer known for speaking out for secular freedom died after being attacked by machete-wielding assailants in the Bangladeshi capital of Dhaka, a local police official said.

Roy, the founder of the website Mukto-Mona, and his wife were assaulted as they walked back from a speaking engagement, said Krishna Pada Roy, a deputy commissioner with the Dhaka police.

Police were investigating a "local hard-line religious group" that praised the killing online, the BBC reported.

Ajay Roy, Avijit's father, filed a case of murder with the Shahbagh police on Friday without naming suspects.

The father, a retired professor at Dhaka University, later told reporters his son was killed by extremist and communal groups backed by Jamaat-e-Islami, the main Islamist political party in the country. Avijit Roy had received death threats several times for posting his views on blog, his father said.

Jamaat-e-Islami, however, protested Ajay Roy's statement and demanded punishment of the killers.

Shahbagh police officer-in-charge Sirajul Islam said, "The nature of the attack suggests a fanatic group might have been behind the murder."

Images published Friday on the blog of another prominent writer from Bangladesh show Roy, surrounded by onlookers, lying face down in a pool of blood.

'No one came'

"Bangladesh has become a safe haven for Islamists where they can do whatever they like," Taslima Nasreen, who had to leave Bangladesh after receiving death threats from extremists, wrote in her blog.

"They can kill people with no qualms whatsoever. Avijit Roy has been killed the way other free-thinking writers were killed in Bangladesh. No free thinker is safe in Bangladesh."

Roy died at a nearby hospital, the police official said. His wife suffered injuries of her own, including a severed finger.

The attackers carried knives and machetes.

A witness said an assailant pulled out "a big knife" and struck Roy from behind in the head and shoulders. Roy's wife, Rafida Ahmed Bonna, also was hacked on the shoulders.

"I shouted for help from the people but nobody came to save him," the witness told CNN. "No one came."

Last year, an Islamist activist said that Roy "will be murdered when he comes back" to Bangladesh, the author wrote in the Free Inquiry article.

Roy reported such threats on his life, according to people who knew him.

Despite threats, the writer regularly returned to Bangladesh for the February book fairs, said Michael De Dora, a friend of Roy's.

"Avijit was very idealistic," he said. "His understanding was that he wouldn't be killed, that if anyone ever tried to attack him or hated him, that they could just kind of have a chat and he would convince them ... that they could at least have a dialogue."

De Dora said Roy, who was an American citizen, reported last year's threat to the FBI, but the author was skeptical of alerting Bangladeshi authorities.

"For him, even if he was getting threats that he thought were serious, to not be able to go back to his home country and meet with activists and other bloggers and writers would be kind of horrible thought for him," De Dora said.

As in France after Islamic extremists murdered 12 people at the offices of satirical magazine Charlie Hebdo in Paris, Roy's killing has generated public outcry and demonstrations in Bangladesh.

"Dhaka University is a cradle of exercising free thoughts and democracy," Dhaka University Teachers Association (DUTA) said, according to the national news agency of Bangladesh, BSS.

"For these reasons, the communal extremists chose the university campus to launch attacks on persons of progressive conscience."

'Virus of Faith'

In the Free Inquiry article, Roy wrote compared religious extremism to "a highly contagious virus."

When his book, "The Virus of Faith," was released at a book fair last year, he wrote that the publication "hit the cranial nerve of Islamic fundamentalists," who started threatening his life.

"The death threats started flowing to my e-mail inbox on a regular basis," Roy wrote. "A well-known extremist ... openly issued death threats to me through through his numerous Facebook statuses."

In one widely-circulated post, Roy quotes the extremist as writing, "Avijit Roy lives in America and so, it is not possible to kill him right now. But he will be murdered when he comes back."

The Charlie Hebdo massacre, the threats on his life, the removal of his books from a Bangladesh online bookstore after pressure from extremists prove that "the virus of faith is dangerously real," Roy wrote.

Roy and his wife were attacked on the Dhaka University campus as they were leaving a book fair where Roy had spoken.

Based out of the Atlanta area, Roy was a "prominent defender of the free thought movement (and) advocate of atheism, science and metaphysical naturalism," according to his website . He authored seven books and his writings were also featured in numerous magazines and journals.

The couple has a daughter, Trisha Ahmed, a student at Johns Hopkins University, De Dora said.

Roy's outspokenness, especially on matters of religion, made him a target in Bangladesh, where nearly 90% of people are Muslim and 10% are Hindu, according to the U.S. government

'A great loss'

Roy wrote that the day is "dedicated to those who are systematically being persecuted, harassed, or killed for their simple expression of Freethought (more precisely, for their 'blasphemous' views towards religion)."

Countries such as Pakistan, Saudi Arabia, Iran and Bangladesh have "retained social ideas that are reminiscent of the medieval age," when blasphemy laws were "equated with sin," the author wrote.

In Bangladesh, bloggers were jailed "on the sole basis that they were openly atheist," he wrote.

In Pakistan, the U.S. Commission on International Religious Freedom reported at least 203 incidents of violence "in the name of religion," resulting in more than 700 deaths in an 18-month period. In Saudi Arabia, he wrote, a 19-year-old gang-rape victim was sentenced to 200 lashes and six months in jail for "indecency" and speaking to the press.

"The nonbelievers in these Islamic countries face the most severe treatment at the hands of both mullahs and the state," Roy wrote.

De Dora, director of the Amherst, New York-based Center for Inquiry's office of public policy, called the author's death "a great loss."

"Avijit was brilliant, yes, and a devoted advocate of free expression and secularism, but also just a very good person," he said in a statement. "Avijit was an inspiration to countless other freethinkers, in Bangladesh and around the world, and he was an inspiration to me."

Threats ignored

Bangladeshi Health and Family Welfare Minister Mohammad Nasim condemned the killing and called for the "expeditious nabbing of the killers and their exemplary punishment," the BSS news agency reported.

Information Minister Hasanul Haq Inu "expressed deep sorrow and sympathy at the untimely death" on the same news site.

Jadabeswar Bhattacharjee, a contributor to Mukto-Mona, posted Friday that Roy had been killed by "some brain-dead Islamist bigots."

"I have no word to condemn this heinous crime perpetuated by these Islamist cowards," he wrote. "When such Islamist cowards failed in intellectual discourse with Avijit and when they found that their dogma has been proved hollow by Avijit, they settled the score by murdering him."

Bob Churchill, a spokesman for the London-based International Humanist and Ethical Union, said the "loss is keenly felt by freethinkers and humanists in South Asia and around the world" and called Roy "a colleague in humanism and a friend to all who respect human rights, freedom, and the light of reason."

The IHEU said in a statement that an Islamist activist "well-known" to authorities early last year threatened Roy and "repeatedly and openly talked about wanting to see secular and freethought writers dead."

"Those under threat have complained that authorities have ignored his threats and incitement, despite his credible links to Islamist extremists and similar murders taking place," the statement said.

There was no immediate response to the claim from authorities in Bangladesh.