Image copyright Handout FBI

Canadian Joshua Boyle and American Caitlan Coleman were rescued this month after being held captive for five years by a Taliban-linked insurgent group. But what were two Western backpackers doing in Afghanistan in the first place?

"Looking back, I think it was two years before we saw any proof they were alive," recalls Joshua Boyle's friend Alex Edwards.

"I had assumed that they were probably dead, and tried to make peace with that."

Joshua Boyle and Caitlan Coleman were kidnapped in Afghanistan in 2012 after venturing into one of the most hostile regions of the war-torn country.

The last email from Boyle, sent to Coleman's parents on 8 October of that year, said they were in a part of Afghanistan he described as "unsafe".

The two were held in captivity for five years, suffering violence and abuse. Boyle says one of the children they conceived during the ordeal was killed by their captors.

Edwards says when he first heard his friend had travelled to Afghanistan with Coleman - who was seven months pregnant at the time - he couldn't understand how they had "done something so appallingly dangerous".

Family and friends have described Boyle and Coleman as naive idealists - a couple with strong convictions and humanitarian inclinations.

In interviews following their release, Boyle said he and Coleman travelled to Afghanistan to help people. He called himself a "pilgrim" on a mission.

He told reporters he went to help "the most neglected minority group in the world. Those ordinary villagers who live deep inside Taliban-controlled Afghanistan, where no NGO, no aid worker and no government has ever successfully been able to bring the necessary help".

What exactly the couple intended to do to help is a question that hasn't been answered.

Image copyright AFP Image caption A French soldier secures a perimeter on a forward observing post in the Wardak province

Coleman, 31, grew up in Stewartstown, a small Pennsylvania town about 100 miles west of Philadelphia.

Boyle, 34, was raised in Smith Falls, near Canada's capital city Ottawa.

The two met online, reportedly bonding over a shared love of Star Wars. They married in 2011.

Friends interviewed in 2016 by Philadelphia magazine describe Coleman as a devout Christian who loved travel and had a gentle sense of humour - "big-hearted, relentlessly optimistic, adventurous, funny and flawed".

Boyle - a self-described "pacifist Mennonite hippie child" according to Edwards - has a more contentious past.

He was briefly married to Zaynab Khadr, the sister of former Guantanamo bay inmate Omar Khadr. The union pulled him publicly into the orbit of one of Canada's most notorious families.

Image copyright Handout FBI Image caption Joshua and Caitlan before their capture

The Khadr family patriarch, who was killed in Pakistan in 2003, was an alleged close associate of Osama Bin Laden.

Zaynab herself is well known for her outspoken views, refusing to condemn terror attacks like the London bombings of 2005 or downplaying 9/11.

Omar Khadr, who was caught in Afghanistan at 15 by American forces, was held in Guantanamo for 10 years and charged with the murder of a US soldier.

Critics accuse him of being a radicalised fighter at the time of his capture.

But Omar's supporters considered him a child soldier and Boyle - a human rights advocate - took a deep interest in his case.

His marriage to Zaynab Khadr ended in 2010.

The Associated Press has reported that US officials don't believe Boyle's former ties to the Khadr family had anything to do with the kidnapping of him and his wife.

Before leaving on their Central Asian adventure, Coleman had told friends they would only travel to the "safe '-stans" during their six-month trip. But at some point, that changed.

Image copyright Handout FBI Image caption The couple pictured before their kidnapping

In 2012, a UK man met Joshua Boyle and Coleman in Bishkek, the capital of Kyrgyzstan.

Richard Cronin describes how Boyle - after a long night spent discussing historic explorers - convinced him to travel to Afghanistan.

Boyle and Coleman had been backpacking in Russia and the former Soviet Republics of Kazakhstan, Tajikistan and Kyrgyzstan.

Afghanistan was next on the list.

"I asked Josh where he wanted to go in Afghanistan and he replied 'all over'.

"He had also said it was safe provided you didn't go to a region where there were foreign troops and the Taliban, namely the south," Cronin wrote in a blog about the encounter.

While in Afghanistan, Cronin learned that Boyle and Coleman had gone missing in the country.

Cronin later told a Toronto Star reporter who covered the couple's lengthy captivity: "I hope Josh and his family get out safely. I have some questions I'd really like to ask them. I'm sure you do too".

Image copyright AFP/Getty Images Image caption The Pakistan-Afghanistan border

In 2013, after months of anguished mystery, the Boyle and Coleman families learned what had happened to the vanished couple.

They had been taken hostage by the Taliban-linked Haqqani network while travelling in the Wardak Province, a mountainous region outside Kabul.

A man believed to have ties to the Taliban emailed the Coleman family two videos of Boyle and their daughter, asking for the US and Canada to do more to free them from their captors.

In the video - the first of four released to the families - they appear tired, dispirited, and dazed.

Coleman had given birth to her first son in captivity.

Media playback is unsupported on your device Media caption File video of Joshua Boyle and his wife Caitlan Coleman while in captivity

Boyle and Coleman's families made those first two videos public in 2014 after the release of US soldier Bowe Bergdahl, who had also been held as a Taliban captive, hoping the publicity would help their appeal for the couple's safe return.

The last video released of the two came out just 10 months ago, shortly before Christmas. It showed Boyle and Coleman with two of their children.

In that video, Coleman described their situation as a "Kafkaesque nightmare".

The family was subject to mistreatment and violence during their captivity. In interviews, Boyle says the family was frequently shuffled between locations, often held in rooms not much bigger than a toilet stall.

There were times Boyle and Coleman were separated and beaten.

But Boyle has also said one of their biggest challenges was the daily tedium, the long hours with little to fill them.

In a short email exchange with the BBC, Boyle described passing the time educating their two sons.

"We had always intended to home school our own offspring - we just hadn't foreseen it would be without books, paper or pen... but we made do with what we had, tore up old garbage to make solar systems, splinters of wood to learn multiplying, bottle caps became compasses, etc," he wrote.

He told the Associated Press that they decided to have children in captivity because "we're sitting as hostages with a lot of time on our hands. We always wanted as many as possible, and we didn't want to waste time. Cait's in her 30s, the clock is ticking."

Image copyright AFP/Getty Images Image caption An Afghan security force member keeps watch at the site of a suicide attack in Wardak province

In the intervening years, Boyle and Coleman's family and friends expressed frustration at the apparent lack of interest from the US and Canadian officials, and the media and public's indifference to their plight.

"It doesn't get the attention it deserves, and I have no idea why," a friend told Philadelphia magazine in a 2016 feature about Coleman.

"It's just messed up. She's a person. She has a family. She's not just this 'kidnapped American woman.'"

Media playback is unsupported on your device Media caption Caitlan Coleman's family appealed for their daughter's return in 2012

Edwards says he received mostly disinterest when he tried to get the Star Wars and Firefly fan communities - Boyle was an aficionado of both - to help raise awareness of their case.

In retrospect, he feels it's clear why he couldn't rally people to their cause.

"People don't want to help with something unless they know it's the right thing to do, and there were just too many complicating factors in Josh and Caitlan's situation," he says.

"What were they doing in Afghanistan? What's the deal with the Khadr connection? I tried to answer those questions as best I could, but the fact that they even came up is a huge strike against people caring."

But Edwards says: "The fact that no one seemed particularly concerned about two Canadian children being held captive by the Taliban is a shocking indictment of our society."

Image caption The couple were captured in Afghanistan's Wardak province and rescued near Kohat, Pakistan

In 2015, a retired Special Forces officer testified before a US Senate committee about a plan to rescue to Boyle, Coleman and their children from captivity as part of a larger prisoner swap.

The Green Beret's team had been tasked with trying to help bring soldier Bowe Bergdahl home.

"We also realised that there were civilian hostages in Pakistan that nobody was trying to free so they were added to our mission," Jason Amerine said, mentioning Boyle and Coleman by name in his testimony.

The rescue plan collapsed, though Bergdahl was eventually released in 2014 in a controversial Taliban prisoner exchange.

It seemed that Boyle and Coleman were slowly being forgotten.

So their release after five years of captivity came as a surprise.

On 12 October, Pakistani and US officials confirmed Pakistani troops rescued the family in a successful but risky mission - shooting out the tyres of the car where they were stuffed in the boot.

Boyle, Coleman and their three children were safe and heading home.

Media playback is unsupported on your device Media caption "It was amazing" - Boyle's parents relive the moment they heard of his release

Aisha Ahmad, a University of Toronto political scientist who studies jihadist groups, suggests it was no coincidence the timing of the rescue came during a tense period between US and Pakistan.

"The reason the Pakistanis were so willing to pull the trigger is because they desperately needed to mend relations with the new Trump administration," she says.

The family's release netted rare praise for Pakistan from Mr Trump who called it "a sign that it [Pakistan] is honouring America's wishes for it to do more to provide security in the region".

"The Pakistani army and the intelligence community are very realistic in their calculations - they are strategists," says Ahmad. "They care about geopolitics, they play the long game."

On Thursday, CIA director Mike Pompeo told a Washington-based think tank Boyle and Coleman were held in Pakistan during their long captivity, contradicting earlier claims made by Pakistani officials.

Image copyright Reuters Image caption Joshua Boyle speaks to media at Toronto's Pearson airport

After landing in Canada, Joshua Boyle struck out at his former captors.

He says the "criminal miscreants" raped Coleman and killed a fourth child - a daughter - in a forced abortion.

The Taliban have denied Coleman was assaulted and claim the child died due to a miscarriage.

Boyle told the BBC about the one captor he got to know, a man from the West with whom he could "ask esoteric questions on little-known points of Islamic law and history".

After the learning of the rape by some of the guards, the man defected to the so-called Islamic State "try to find a truer jihad" and promised "to try and tell ISIS of the cruelties, acts of disbelief and hypocrisy of the Haqqani Network".

"I offered him my fullest forgiveness, and Caitlan said she would forgive him all his minor sins against her, but she couldn't forgive what he'd done to the children in his blind exuberance for the group at the start," Boyle wrote.

Image copyright AFP Image caption Joshua Boyle plays outdoors with his son near his family's home

For now, Boyle, Coleman and their three children are adjusting to their newfound freedom in the suburban sanctuary of Boyle's parents' Ontario home.

The children have the resilience of youth and attentive grandparents, and Boyle has said they're slowly adapting to their new circumstances, though the family continues to sleep together in one small room.

"It's not welcome to the western world, it's not welcome to Canada, it's welcome to life," he told NBC's Today programme.

Coleman has not spoken publicly since her release and was admitted to hospital earlier this week with an undisclosed ailment.

Boyle told journalists the couple are focusing on building a safe home for their children and that he remains committed "to do the right thing no matter the cost".

"In the final analysis, it is the intentions of our actions, not their consequences, on which we all shall eventually be judged."

.