An American woman, her Canadian husband, and their three children were freed from captivity on Wednesday after being held hostage by Taliban-linked for five years, officials announced.

Caitlan Coleman and her husband, Joshua Boyle, were taken captive in 2012 while traveling in a mountainous part of Afghanistan, near Kabul. The pair were held hostage by the Haqqani network, an organization with ties to the Taliban, in Afghanistan for much of the five years.

Coleman was pregnant at the time they were captured and gave birth to the couple's three children while they were held.

The Coleman-Boyle family had appeared in multiple hostage videos over the years. In December of 2016, Coleman asked the US government to save them from their "Kafkaesque nightmare."

But US authorities on Wednesday tracked the family being moved into Pakistan, where an operation was carried out by the local army to free them.

"The operation by Pakistani forces, based on actionable intelligence from US authorities was successful," the Pakistani army said in a statement. "All hostages were recovered safe and sound and are being repatriated to the country of their origin."

Chrystia Freeland, the Canadian Minister of Foreign Affairs, said she was "greatly relieved" by the family's release. "We stand ready to support them as they begin their healing journey. We ask that the families' privacy be respected," her statement read.