Pakistani soldiers have freed a North American family of five who were being held hostage by the Afghan Taliban.
Canadian Joshua Boyle and his US wife Caitlan Coleman were kidnapped while backpacking in Afghanistan in 2012. They had three children while in captivity.
They were rescued after a US tip-off during an operation near the Afghan border, the Pakistani army said.
US President Donald Trump said it was a "positive moment" for US-Pakistan ties.
"Ms Coleman gave birth to the couple's three children while they were in captivity," Mr Trump said in a White House statement. "Today, they are free."
He added: "The Pakistani government's co-operation is a sign that it is honouring America's wishes for it to do more to provide security in the region."
Videos of the couple were released by their captors, the Taliban-aligned Haqqani network, during their captivity. The insurgent group has been demanding the release of three of its prisoners in Afghanistan.
The latest video , released last December, showed the couple with two young boys. In it, Ms Coleman - who was pregnant when she and Mr Boyle were abducted - begged for an end to what she called their "Kafkaesque nightmare".
The Pakistani army said US intelligence agencies had been tracking the family in Afghanistan, and reported that on 11 October they had moved across the border into the Kurram tribal district of Pakistan.
In a statement it said: "The success underscores the importance of timely intelligence sharing and Pakistan's continued commitment towards fighting this menace through co-operation between two forces against a common enemy."
In a video statement released to the Toronto Star newspaper, Linda Boyle said she and her husband Patrick had spoken to their son Joshua by telephone after his release.
"That's the first time in five years we got to hear his voice," she said. "It was amazing."
The couple offered thanks to the Pakistani soldiers who had "risked their lives" to rescue the family.
They said Joshua had said his children were looking forward to meeting their grandparents, and that he hoped to see them within days.
However, Reuters news agency quotes anonymous US officials as saying that the US military had been ready to fly the family out of Pakistan - but Mr Boyle had refused to board the aircraft.
Mr Boyle was once married to a woman who espoused radical Islamist views and is the sister of a former Guantanamo Bay inmate , Omar Khadr. CNN suggested he might fear prosecution by the US authorities.
Asked about this, Canada's Foreign Affairs Minister Chrystia Freeland said: "Joshua Boyle is not the subject of an investigation. Our focus is very much on the safety and the security of this family."
Ms Freeland also said Canada did not pay any ransom for their release.
Earlier, she had said her government was "greatly relieved" the family had been released and was safe, and thanked the US, Afghanistan and Pakistan.
"Joshua, Caitlan, their children and the Boyle and Coleman families have endured a horrible ordeal over the past five years. We stand ready to support them as they begin their healing journey," she added.
'They need one another'
By Gary O'Donoghue, BBC Washington correspondent
Relations between Washington and Islamabad have been fraught for years.
The US believes that Pakistan allows groups such as the Haqqani network to shelter within its borders, and that Pakistan's intelligence services have close links to the Taliban and other hostile groups inside Afghanistan.
In August, President Trump said: "We have been paying Pakistan billions and billions of dollars at the same time they are housing the very terrorists that we are fighting. But that will have to change, and that will change immediately."
For its part, Pakistan accuses the US of failing to understand the sacrifices it has made in terms of lives through terrorist attacks on its soil.
Nevertheless, both sides need one another and so some kind of transactional relationship remains important.
Mr Trump went out of his way to thank Pakistan for its role in the rescue of the family, drawing a direct connection between his approach and the happy outcome.
But Washington will want to see further evidence over time that Pakistan is willing to continue co-operating before anything like real trust can exist between the two countries.