ISLAMABAD, Pakistan — A Swiss couple held by the Taliban in northwestern Pakistan for eight months turned up at a military checkpoint early on Thursday and were flown by helicopter to Peshawar and then Islamabad, where they were handed over to the Swiss Embassy, officials said.

It was unclear how the two obtained their freedom. A Pakistani military spokesman, Maj. Gen. Athar Abbas, said they had escaped. But in a video released last week, another Taliban hostage, Ajmal Khan, the head of a university in Peshawar, said that the government had agreed to pay “millions of rupees” and to free 100 prisoners in exchange for the Swiss hostages.

Kidnapping has become a major source of revenue and propaganda for the Pakistani Taliban and associated militant factions based in North and South Waziristan, the tribal agencies at the heart of militant operations that have borne the brunt of American drone strikes in recent years. Hostages captured by various groups around the country, or in Afghanistan, are often sold to the Taliban or Al Qaeda and transferred to the tribal belt.

Along with high-profile kidnappings of foreigners, the Taliban have targeted dozens of wealthy and prominent Pakistanis, some of whom have spent years in captivity. On Thursday night, the local news media reported that Amir Malik, 41, a wealthy jeweler kidnapped from Lahore in August 2010, had been freed in Waziristan.