Image copyright AFP Image caption Farabi Shafiur Rahman (C) has been arrested before over threats to bloggers

Police in Bangladesh have arrested a man in connection with the murder of atheist writer Avijit Roy.

Farabi Shafiur Rahman, a "fundamentalist blogger", was detained by special police forces early on Monday at a bus stop in Dhaka.

He is accused of making a recent threat to kill Mr Roy on social media.

Avijit Roy, a US citizen of Bangladeshi origin, was hacked to death by men with machetes last Thursday while visiting Bangladesh. His wife was badly wounded.

Colonel Ziaul Ahsan, from Bangladesh's Rapid Action Battalion (RAB), told local media bdnews24.com that Mr Farabi was leaving the city when he was arrested in Dhaka's Jatrabarhi area on Monday morning.

RAB spokesman Major Maksudul Alam said he was "the main suspect" in the attack on Avijit Roy, who was a critic of religious intolerance.

Image copyright AP Image caption Avijit Roy was well known for his blog celebrating free thinkers and humanists

Mr Roy's family said he had been threatened by Mr Farabi on Twitter and Facebook, Maj Alam said.

"[Roy's] family told us that he got threats from Farabi several times," he told AFP news agency.

Police accuse Mr Farabi of involvement with the Islamist group Hizb ut-Tahrir, which is banned in Bangladesh.

On Sunday, the Bangladeshi government accepted a US offer of FBI help to assist in the murder inquiry.

Wife in hospital

Avijit Roy was attacked last Thursday evening by men wielding machetes as he returned from a book fair in Dhaka, his native city.

His wife Rafida Ahmed also suffered head injuries and lost a finger in the attack and remains in hospital in a serious condition.

Mourners gathered on Sunday in Dhaka to pay their respects to Mr Roy.

"Free thinking in Bangladesh is becoming a great danger," Reuters quoted writer Shahriar Kabir as saying.

"We want to know why the government failed to ensure the safety of him, despite knowing that he had been facing threats from the Islamist radicals."

Farabi Shafiur Rahman is currently on bail in a second case, having been previously arrested over online postings following the murder of another anti-extremism blogger, Ahmed Rajib Haider, in 2013.

Ahmed Rajib Haider was among a group of bloggers who had called for the execution of Islamist leaders for crimes committed in Bangladesh's 1971 independence war.

Avijit Roy

Image copyright AP

Born to a Hindu family in 1972

Founded Mukto-Mona ("Free Mind") blog site in 2000 to champion secular and humanist writing in Muslim-majority Bangladesh

Bangladeshi-born US citizen on visit to Bangladesh

Engineer by profession

Received recent death threats from Islamist radicals for his writings, family say

"He was a thinker, he was a man of great knowledge, he was a scientist, he was an engineer" - close friend and Dhaka University professor Anwar Hossain

Obituary: US-Bangladesh writer Avijit Roy