WASHINGTON: An American-Canadian family that spent years in Taliban captivity was released following a Pakistani operation, officials said Thursday, but refused to immediately board a US-bound jet over concerns about the husband´s past links to a former Guantanamo Bay inmate.

US President Donald Trump hailed the couple´s freedom after five years held in the lawless Afghan-Pakistan border region by the notorious Haqqani network.

"The Pakistani government´s cooperation is a sign that it is honoring America´s wish that it do more to provide security in the region," Trump told reporters.

"They worked very hard on this, and I believe they´re starting to respect the United States again," he said, adding that "a lot" of other nations were also showing greater deference to the US .

Defense Secretary Jim Mattis meanwhile praised the release as a positive step in often rocky US-Pakistan ties.

"This is a very positive moment and the Pakistan army performed well. We will hopefully see it being a harbinger for the future," he told reporters on Thursday afternoon, without offering details about the nature of the operation.

Concern over Guantanamo links
Caitlan Coleman and Joshua Boyle were kidnapped during a backpacking trip in Afghanistan in 2012, and had three children while in captivity.

A US military official said American forces were not involved in any rescue, but that a medical team had been able to meet the family and stood ready to fly them home if needed.

Another military official told AFP the couple was hesitating to board a US military jet in Pakistan over the Canadian husband´s concerns he could face American scrutiny for links to a former Guantanamo captive.

In 2009, Boyle was briefly married to Zaynab Khadr, the sister of Canadian-born Omar Khadr, who spent a decade at Guantanamo.

But the official said Boyle did not risk any US repercussions.

"It is not in our intention to do anything like that. We are prepared to bring them back home," the official said. Trump identified the captors as the Haqqani group, whose head, Sirajuddin Haqqani, is also the Afghan Taliban´s deputy leader.

Canada´s Foreign Minister Chrystia Freeland added that Boyle was not being investigated by Ottawa.

"Let me be very clear and as we have been with the Boyle family," she said in a televised statement from Mexico where she was traveling. "Joshua Boyle is not the subject of any investigation."

High-profile attacks
Pakistan has been under increased pressure from Washington to crack down on alleged militant sanctuaries inside its borders after Trump lambasted the country in a televised address in August.

During the speech, Trump accused Islamabad of sheltering "agents of chaos" and suggested ties with Pakistan would be adjusted immediately but offered few details.

Defense Secretary Mattis and Secretary of State Rex Tillerson are expected in Pakistan in the coming weeks on separate visits, according to US and Pakistani sources, to maintain pressure on a country that was designated a major non-NATO ally by former president George W. Bush.

The Haqqani network has been accused of masterminding several high-profile terrorist attacks in the Afghan capital, including a massive truck bomb on May 31 that killed some 150 people.

They have been known to kidnap Western hostages and smuggle them across the Afghan border into Pakistan, as appears to have been the case with Coleman and Boyle.

The Pakistani military said the hostages had been "recovered... from terrorist custody through an intelligence-based operation by Pakistani troops."

´Horrible ordeal´
They were found in Kurram district, part of Pakistan´s semi-autonomous tribal belt, where militants such as the Haqqanis operated with impunity until the army intensified an operation there in 2014.

"US intelligence agencies had been tracking them and shared their shifting across to Pakistan on 11 Oct 2017 through Kurram Agency border," the Pakistani military said.

Boyle and Coleman appeared in a hostage video in December last year with two of their children pleading for their release.

The video was released after rumors swirled in Kabul that the government was planning to execute Anas Haqqani, son of the Haqqani network´s founder, who has been held since 2014.

Freeland expressed relief at the release.

"Joshua, Caitlan, their children and the Boyle and Coleman families have endured a horrible ordeal over the past five years," she said.

Afghanistan is rife with militants and organized criminal gangs who stage kidnappings for ransom, targetting wealthy Afghans and foreigners, who have been ferried over the border.

The Taliban are also thought to be holding American Kevin King and Australian Timothy Weekes, professors at the American University of Afghanistan who were dragged from vehicles in Kabul by gunmen.