A man who was recently rescued from the Taliban after years in capitivity said he didn't think his captors were being serious when they told him that the new president of the United States was Donald Trump.

34-year-old Joshua Boyle, who is from Canada, made the quip in a wide-ranging interview with the Toronto Star just days after he and his wife, 31-year-old American Caitlin Coleman, and their three children were rescued after joint efforts by US intelligence and Pakistani forces.

The newspaper reported that the family had no idea that Justin Trudeau had become the Prime Minister of Canada – but a captor had told Boyle of Trump becoming US President while he was being forced to make a "proof of life" video.

"It didn't enter my mind that he was being serious," Boyle told the star.

The couple's three children were all born in captivity during the five-year ordeal. They had been hiking in Afghanistan's Ghazni province in 2012 when they were kidnapped.

The rescue was lauded by the US as a marker of a growing relationship between America and Pakistan. US Secretary of State Rex Tillerson said in a statement: "I applaud the innumerable lines of effort from across the US Government. I'm particularly proud of Ambassador Hale and his Mission Islamabad team for their engagement with Pakistan. These efforts reflect the best of what America can accomplish."

"The United States also expresses our deep gratitude to the Government of Pakistan and the Pakistani Army for their cooperation. President Trump's new South Asia strategy recognizes the important role Pakistan needs to play to bring stability and ultimately peace to the region. The United States is hopeful that Pakistan's actions will further a U.S.-Pakistan relationship marked by growing commitments to counterterrorism operations and stronger ties in all other respects."

The family was held hostage by the Haqqani network, a Taliban-affliated insurgent group in Afghanistan.