The head of the CIA said on Thursday a U.S.-Canadian couple kidnapped by Islamist militants in Afghanistan were held inside neighboring Pakistan for five years before being freed.

"We had a great outcome last week when we were able to get back four U.S. citizens who had been held for five years inside of Pakistan," CIA Director Mike Pompeo told the Foundation for Defense of Democracies think tank in Washington.

Pompeo's remarks appeared to be the first time a U.S. official has publicly stated that the couple and their children spent their captivity in Pakistan, contrary to accounts from Pakistani officials.

CIA Director Mike Pompeo speaks during the Foundat FILE - CIA Director Mike Pompeo speaks during the Foundation for Defense of Democracies National Security Summit in Washington, Oct. 19, 2017. FILE - CIA Director Mike Pompeo speaks during the Foundation for Defense of Democracies National Security Summit in Washington, Oct. 19, 2017.

Pakistan's military and government have indicated U.S. citizen Caitlan Coleman, her Canadian husband Joshua Boyle and their children were rescued shortly after entering Pakistan from Afghanistan. The couple were kidnapped in 2012 while backpacking in Afghanistan and their children were born in captivity.

U.S. officials, speaking on condition of anonymity, have previously said there was no indication the hostages had been in Afghanistan in the days before they were freed.

The officials said the United States believed the hostages were probably held by the Haqqani militant group in or near its headquarters in northwestern Pakistan the entire time.

Regarded as the most fearsome and effective Taliban ally, the Haqqani network gets support from elements of the Inter-Services Intelligence, Pakistan's powerful military-run intelligence agency, U.S. officials say. Pakistan denies it.

A senior Pakistani security source said last Friday that Pakistani troops and intelligence agents, acting on a U.S. intelligence tip, zeroed in on a vehicle carrying the family as they were being moved into the Kurram tribal region near the town of Kohat, some 60 km (37 miles) inside Pakistan.

Pakistani officials bristle at U.S. claims Islamabad is not doing enough to tackle Islamist militants, particularly the Haqqanis.

After the release of the family, Pakistani officials emphasized the importance of cooperation and intelligence sharing by Washington, which has threatened to cut military aid and take other punitive measures against Pakistan.

However, two Taliban sources with knowledge of the family's captivity said they had been kept in Pakistan in recent years.

The Haqqani network operates on both sides of the porous Afghan-Pakistani border, but senior militants have acknowledged they moved a major base of operations to the Kurram region.

As part of a strategy unveiled in August to end the war in Afghanistan, the Trump administration is demanding Pakistan cease providing what U.S. officials say is safe haven to militants, or face repercussions. Those measures could include further cuts in U.S. assistance and sanctions targeted at Pakistani officials with links to militant organizations.

Tillerson visit

Pompeo's remarks came ahead of a visit to Pakistan next week by U.S. Secretary of State Rex Tillerson, who said on Wednesday the United States expected Pakistan "to take decisive action against terrorist groups."

A senior Trump administration official, speaking on condition of anonymity, said on Thursday the United States considers the family's rescue a "template for more cooperation" by Pakistan.