One of Bangladesh's top writers was stabbed in the back of the head during a seminar in the northern city of Sylhet on Saturday, police said, the latest in a series of attacks on authors and bloggers.

Police said Zafar Iqbal, a celebrated secular activist and bestselling science fiction writer, was rushed to hospital in Sylhet after the attack.

"He was hit on the back of his head and he was bleeding," a police constable posted at the hospital told AFP, speaking on condition of anonymity.

Abdul Wahab, a spokesman for the Sylhet city police, confirmed the incident, saying police suspect he was attacked with a knife.

"He was in a seminar when he was stabbed on the back of his head. His gunman caught an attacker," he told AFP, referring to Iqbal's police guard.

Bangladesh's government has provided security for the country's top secular writers and activists since suspected Islamist extremists named them in a several lists of targets.

Police do not know how many people were involved in the attack nor whether they belonged to any Islamist extremist groups, he said.

"He has been taken to the operating theatre," he said, adding he would be flown to a military hospital in Dhaka for better treatment.

Iqbal, who teaches at a state-run university in Sylhet, is a longstanding a champion of free speech and secularism in Bangladesh.

He is also a top selling author and celebrity speaker who regularly appears at university campuses nationwide.

The attack was swiftly condemned by protesters in Dhaka and Sylhet.

In Dhaka's Shahbagh Square, which became famous for massive 2013 protests against Islamist war criminals, hundreds of people carried torches to protest against the attack and demand swift justice.

"It is an ominous sign. He is a guardian of progressive movement in Bangladesh. His attack is an attack against progressive Bangladesh," said Imran Sarker, head of one of the top secular groups.

"He was in the hit-list by militant and other groups in the past. The government can't avoid its responsibility," he told AFP.

Prime Minister Sheikh Hasina strongly condemned the attack and ordered security forces to track down the culprits, her press secretary Ihsanul Karim said.

Suspected Islamist extremists have carried out a series of attacks on secular and atheist writers and bloggers in the last four years, killing around a dozen of them including an American atheist blogger of Bangladeshi origin.

Police have blamed homegrown Islamist extremist group Ansarullah Bangla Team (ABT), also known as Ansar al Islam, which is linked with Al-Qaeda in the Indian subcontinent for most of the attacks.

Bangladesh has been waging a war against homegrown extremism in the wake of numerous attacks by radical groups in recent years.

In July 2016 militants stormed a Dhaka cafe and massacred 22 hostages, including 18 foreigners, in an assault claimed by the Islamic State group.

Security forces have shot dead more than 70 alleged militants in a severe crackdown since the cafe carnage.

Late last year police arrested an alleged militant from ABT over the 2015 murder of the American blogger in Dhaka.