For writer Raihan Abir and his pregnant wife, Samia Hossain, the morning commute by motorcycle meant weaving through the clogged roads and crawling traffic of the Bangladeshi capital, Dhaka – dodging cars, rickshaws and rickety buses crammed with workers.

But there was another reason to constantly scan the road over the hour-long trip: They worried that among the teeming crowds of commuters lurked vicious assassins.

"Whenever we started out of the house," Samia recalled, "he used to ride the motorcycle and I used to look backward all the time to make sure no one's following us or going to do anything to us."

Story continues below advertisement

Since February, religious extremists have tightened the net around atheist and secular writers in Bangladesh. They have picked off the young couple's closest friends in gruesome machete attacks carried out in the street, in the home and in publishing offices – leaving five dead and four others seriously injured.

The victims had been challenging religion in blogs and in books, and Raihan, prominent in that circle, feared he would be next. After dropping Samia off at work, he would often continue on to the university where he was studying, parking his motorcycle but keeping his helmet on despite the 30-degree heat. The attackers – if they did come – would likely use machetes to target the head.

"At least I'll survive the first attack," Raihan said.

He thought he could evade the extremists – and salvage his life in a city of more than 15 million people.

He would be wrong.

This is the story of how Raihan and Samia escaped the fate of their friends, and of the Canadians who helped them find safety.

'Free thinking'

Story continues below advertisement

As an undergraduate student, Raihan was drawn to the burgeoning online spaces like Mukto-Mona – meaning "free thinking" – a website that became a hub for atheist and secular writers. Its main online moderator was a Toronto-based real-estate agent and Bangladeshi ex-pat, Farid Ahmed.

The people Raihan met became his co-authors, publishers, editors and fellow bloggers. They met over chai and lunch of rice and chicken curry in the capital Dhaka. There was laughter and passionate debate.

The tradition of atheist and secular thought in Bengali culture goes back more than 100 years. But in the modern push-and-pull between secular and Islamist camps, atheists have increasingly become targets in officially secular Bangladesh.

He and other writers have tried to debunk parts of the Koran, Bible and Hindu sacred texts and described religious faith as a virus that breeds extremism and threatens freedom.

The backlash from Islamic extremists began to build in recent years with hit lists and attacks. In 2015, the violence spiked dramatically – and, for Raihan and Samia, started to hit home.

'Raihan, where are you?'

Story continues below advertisement

In many ways, the year had started on a promising note.

Raihan was planning new writing projects; he was completing his PhD in biomedical engineering at the University of Dhaka and was involved in an innovative telemedicine project linking rural patients with doctors and nurses in the capital. Samia, an architect by training, was managing her growing furniture business.

In February, they found out that Samia was pregnant with their first child. They invited friends to their home to break the good news. Among the people they called was a visiting U.S.-based Bangladeshi-American couple.

Avijit Roy launched Mukto-Mona in 2001 while studying in Singapore and later moved to the U.S. to live with his wife, Rafida Ahmed. Ms. Ahmed, also an activist and writer, is a Canadian citizen who lived in Ottawa in the 1990s and worked at Nortel Networks.

Raihan was an avid reader of Dr. Roy's online articles and, in 2009, the two writers met in Dhaka. When Dr. Roy – he had a doctorate in biomedical engineering – wanted to write a book about atheism and evolution, he chose Raihan as his co-author. Philosophy of Disbelief was published in 2011.

Dr. Roy and Ms. Ahmed went to a book fair in Dhaka the night before the baby announcement party.

Story continues below advertisement

At 8:23 p.m., Raihan received a text message from Dr. Roy. "Raihan, where are you?" it read. Raihan had never planned to attend the book fair and told Dr. Roy he was not there.

That night attackers pounced on Dr. Roy and his wife near the book fair. Raihan's mentor had been hacked to death. Ms. Ahmed survived the assault – and is now a prominent voice at global forums and the United Nations calling on the Bangladeshi government to do more to protect writers.

Raihan was never able to tell his friend about the baby.

The February killing sowed panic. Raihan stayed off social media, changed his address and kept away from public gatherings.

The deaths didn't stop there: The next victim, in March, was a blogger known to Raihan.

'We were scared'

Story continues below advertisement

On May 12, Samia called Raihan at his office at the University of Dhaka. Her instructions were to the point: "You need to go."

Earlier that day, Raihan's book editor and close friend, Ananta Bijoy Das, had stepped out of his home in the northeastern city of Sylhet for the daily commute to his bank job when he was chased by men wearing masks and carrying machetes. His murder was the third such incident of the year.

"When he was killed, I said there is no way I'm not next," Raihan said. "They will target me, of course."

His friends pleaded with him to get out of the country. But leaving Bangladesh for a safe place to ride out the storm was not so simple. Mr. Das had applied for a two-week visa to Sweden to speak at a PEN event on May 3; that visa application was rejected.

Before Mr. Das's murder, Raihan had also submitted a visa application. The plan was to attend a medical conference in Toronto in early June with his university supervisor and share some of their research. Now, the outcome of that application could save his life.

The weeks that followed were tense. Raihan received two threatening messages on his cellphone. But he could not go to the police because he did not trust officers to protect him – and feared they would disclose his exact whereabouts to extremist groups.

Story continues below advertisement

In late May, the Canadian visa came through. Raihan packed his bags and said goodbye to his pregnant wife at the airport in Dhaka. They were unsure when they would see each other again, and there was a chance Raihan might not be there for the birth of their child.

But Samia was relieved to see her husband heading to Canada. It was a decision they made together.

"We were scared of being murdered every day," she said. "It's like you go out of the house and you don't know whether you will come back or not. I used to tell him every day, 'Be back safe, be back safe.'"

To stay or to return

Raihan arrived in Toronto in late spring as the city geared up for the Pan Am and Parapan Am Games.

While in the city, Raihan attended seminars at the Metro Toronto Convention Centre and delivered a paper on health-care technology. But his mind was on Bangladesh.

That was clear in a conversation he had then with The Globe and Mail. Over coffee in a Toronto hotel restaurant, the 28-year-old talked about his murdered friends. At times, the words spilled quickly from his mouth and he exuded a nervous energy.

He said he was resolved to continue fighting for a secular and open society in Bangladesh by writing books, articles and blogs. But he faced a more pressing problem: Now that he was in Canada, he had to make a choice – stay and apply for asylum and miss out on holding his first child at birth, or return to Bangladesh and risk his life.

"This is a real dilemma here I'm facing," he said. "I can't go back to Dhaka. If I apply for asylum here, it will take time to bring them here."

Walking back to the medical conference, among the thick crowds outside the aquarium, he made it clear which way he was leaning. "Here," he said with a smile, "you don't have to watch your back."

In June, Raihan decided that Samia had to find a way to get to Canada, and they would apply for asylum together.

Getting Canadian help

For the Centre for Inquiry Canada, aiding Raihan was a chance to get involved in asylum work for the first time. The group was alerted to Raihan's story by its U.S. affiliate, which had close ties to Avijit Roy.

"When I became aware that it was possible for him to come to Canada, it just simply made sense to say, 'We're still new to this work, but if we can help, we will,'" said Eric Adriaans, national executive director of Centre for Inquiry Canada, an education charity that organizes lectures and book tours on science, atheism and skepticism.

In 2009, the group made a splash with a bus ad and billboard campaign. "Jenn 13:1," read one ad showing a young smiling woman holding a cup of coffee. "Praying won't help. Doing will." The tag line under the group's name on the ad reads: "Without God. We're all good."

The group has taken a new direction under Mr. Adriaan's leadership since 2014. The group has heard pleas for help from at least 25 people in Saudi Arabia, Turkey, Pakistan and Egypt who fear for their lives because of their secular and atheist worldviews.

This month, CFI Canada plans to submit an application to the federal government to sponsor a handful of refugees from around the world every year. But there is also the pressing question of how to help several dozen Bangladeshi writers who fear for their lives and are in hiding. Mr. Adriaans said his organization does not have the capacity to take on all the cases – and for that, it is looking to Ottawa for assistance.

Helping an estimated 50 Bangladeshi writers in hiding is much easier than the massive and important effort to bring in 25,000 Syrian refugees in the coming months, he said, "so it's a relatively more manageable problem."

A sobering reunion

On Aug. 6, Samia got her Canadian visa.

She did not want to linger in Dhaka and delay her departure. Like her husband, she was connected with the online world of atheist writers and did not wish to take any chances. The next afternoon, she managed to find a seat on a flight that would take her – very pregnant – to Canada.

Meanwhile, Raihan waited in Toronto with a heavy heart. Raihan had just learned that Niloy Neel, a fellow writer and close friend in Bangladesh, had been hacked to death in his own home. When Samia's plane landed at Toronto Pearson International Airport, he was overjoyed to see her – but had to tell her about the latest killing.

After applying for asylum in September, Samia had her baby. They named her Sophie, after the 14-year-old protagonist in the 1991 Norwegian novel Sophie's World about a teenager's exploration of the history of philosophy.

Raihan has found safety while many of his friends still live in fear.

"I feel like, why me? Why I got the chance? But also I feel the responsibility of doing more work," he said during a recent interview at the midtown Toronto office of the Centre for Inquiry Canada.

He and Samia had their asylum applications approved in November. They will eventually apply for permanent resident status.

Raihan and Samia know how lucky they are. In October, two separate attacks at publishing houses in Dhaka left Raihan's publisher dead and another one injured. Two writers were also injured in the assaults. One was Raihan's friend, Tareq Rahim, who was meeting with a publisher when the attackers entered, stabbed him a dozen times and shot him in the stomach. The bullet is still inside him.

His wife, Monika Mistry, a Montreal resident and Canadian citizen, is calling on Ottawa to help reunite her with her husband in Canada, where he will be safe. The two were married in May in Bangladesh and were preparing an immigration application for Mr. Rahim when the attack happened.

"They couldn't finish their work," she said. "So they will come back. That's the thing, they will come back and attack again."

'Not over yet'

At Raihan and Samia's home in a high-rise Toronto apartment building, Sophie – not yet eight weeks old – squirms as she tries to settle. She goes from mom to dad and back to mom before falling asleep – through hiccups. There are cups of chai and a fresh plate of samosas on the dining table.

They feel immense gratitude and relief. "To me this is the greatest country in the world, right now," Raihan said.

But there is also loss – and anger. Both Raihan and Samia left behind budding careers, families and friends they would meet up with in Dhaka's cafés and teahouses.

The anger is reserved for the extremists who forced them to leave and a Bangladeshi government that has failed to protect writers and bloggers.

Going back to their country of birth is not on the immediate horizon. Each partner has different estimates. Two years, says Raihan. More like five years, says Samia. Whatever happens, the killings will have to stop first.

The last year has been a bad dream. "I'm glad that it's over," Samia said.

"It's not over yet," Raihan cautions. "Because within this month we'll wake up one day in the morning and say, 'That's our friend, he has been killed.'"