Pakistan's army said it had rescued a kidnapped US-Canadian couple and their three children after receiving intelligence from the United States, nearly five years after the couple was abducted in Afghanistan.

American Caitlan Coleman, her Canadian husband Joshua Boyle and the children born in captivity were believed to be held by the Taliban-allied Haqqani network, which the United States has long accused Pakistan of not doing enough to fight.

Ms Coleman and Mr Boyle were kidnapped while backpacking in Afghanistan in 2012.

Ms Coleman was pregnant at the time, and a video released by the Taliban in December showed their two sons born while they were hostages.

Today’s statement was the first mention of a third child.

The rescue came as Pakistan and the United States, uneasy allies in fighting Taliban and other Islamist extremists in the region, are experiencing one of the worst lows in relations.

US intelligence agencies had been tracking the hostages and yesterday shared that they family had been moved across to Pakistan through Kurram tribal area border, the army said.

President Donald Trump said that Pakistan's cooperation signaled a new respect for the United States by Islamabad.

"The Pakistani government's cooperation is a sign that it is honouring America's wish that it do more to provide security in the region," Mr Trump said at a White House event.

"They worked very hard on this and I believe they are starting to respect the United States again."

Canada also voiced relief at the release of the family.

"We are greatly relieved that after being held hostage for five years, Joshua Boyle and his wife Caitlan Coleman, as well as their young children, have been released and are safe," said Foreign Affairs Minister Chrystia Freeland.

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

Ms Freeland said Canada had been "actively engaged with the governments of the United States, Afghanistan and Pakistan" in trying to free the family, but provided no details.