A Canadian man and his family have left Pakistan after being freed from a Taliban-linked group that held them hostage for five years, officials in the country said Friday.

Joshua Boyle, his American wife Caitlan Coleman and their three young children were rescued in a raid carried out by Pakistani commandos on Wednesday after the family and their captors crossed the border from Afghanistan.

Pakistani security officials said the family left by plane from Islamabad, but did not say where the family was headed. The BBC was reporting early Friday that the family was headed to London, England.

Boyle and Coleman were kidnapped in Afghanistan in October 2012 while on a backpacking trip. All three of their children were born in captivity.

Pakistan said Thursday that it had rescued the family in "an intelligence-based operation" after their captors moved them across the border from Afghanistan.

Boyle's parents, who live in Smiths Falls, Ont., said Thursday evening that their son and his family intend to come to Canada.

Patrick Boyle said the family was safe "but exhausted."

"(Joshua) said they've all been up since Tuesday so he was very pleased, he's running on empty," he said outside his home, noting that the family was "over the top" at the word of the release.

"We struggled with every dark spot in the last five years, today that's sort of parked."

Coleman's parents said they were relieved to be able to speak with their daughter after five years but her father said he was angry at Joshua Boyle for taking his daughter to Afghanistan.

"Taking your pregnant wife to a very dangerous place, to me, and the kind of person I am, is unconscionable," he told ABC News.

Foreign Affairs Minister Chrystia Freeland, who has met with the Boyle family in the past, said Thursday that they had endured an "absolutely horrible ordeal."

Freeland refused to describe the circumstances of the release, citing security reasons but said Canada had been working with the U.S., Pakistan and Afghanistan, whom she thanked.

Prime Minister Justin Trudeau, speaking in Mexico City, thanked U.S. and Pakistani officials for their efforts in freeing the captives.

"We're pleased that the ordeal they've been through over these past years has finally come to an end," Trudeau said Thursday night during a news conference.

The release came nearly five years to the day since Boyle and Coleman lost touch with their families while travelling in a mountainous region near the Afghan capital, Kabul.

The couple had set off in the summer 2012 for a journey that took them to Russia, the central Asian countries of Kazakhstan, Tajikistan and Kyrgyzstan, and then to Afghanistan. Coleman's parents last heard from their son-in-law on Oct. 8, 2012, from an internet cafe in what Boyle described as an "unsafe" part of Afghanistan.

-- With files from The Associated Press