However, militants denied the official's claim, saying they had captured nearly 300 soldiers and were still holding them. The statements could not be independently verified.
The Pakistani troops had been traveling in a 16-vehicle convoy providing security for trucks hauling food in the South Waziristan tribal area Thursday, when bad weather forced them to stop and set up camp, an intelligence official said on condition of anonymity because of policy.
The soldiers - who had been traveling between South Waziristan's main town, Wana, and Ladha, another town in the area - were surrounded and captured by Islamic militants who apparently believed the troops were conducting a military operation against the militants.
No fighting took place, said a senior army officer who also spoke on condition of anonymity, citing policy.
Tribal elders intervened at the request of Pakistani authorities to free the soldiers.
"This misunderstanding has been removed," the intelligence official told The Associated Press. "The missing soldiers have been traced and they are safe and would return to their base soon."
But a militant leader, who said his men had seized the soldiers, told AP they were still holding nearly 300 troops.
"About 300 soldiers were present in our areas. We captured them, snatched their weapons and later shifted them to different places," he said by mobile telephone.
Speaking from an undisclosed location, he confirmed that elders had contacted his group about freeing the soldiers.
"We have taken no decision to free the soldiers," he said.
The incident comes two days after militants freed 18 soldiers and a Pakistani government official, kidnapped earlier this month.
Meanwhile, dozens of Islamic militants attacked a northwest Pakistan military checkpoint before dawn Friday, killing at least two soldiers and wounding six others, police said.
The attack happened in the Swat Valley village of Gul Bagh, about 250 kilometers (150 miles) northeast of Peshawar, the capital of North West Frontier Province, said Mohammed Hafeez, the region's police chief.
As the injured and dead soldiers were being transported to a hospital, a car bomb went off near a police vehicle escorting the ambulances and killed a bystander, said Mohammed Khan, another area police official. Authorities were trying to determine whether it was a suicide attack.
Pakistan is a key ally of the United States in its campaign against terrorism, and it has witnessed scores of such assaults after the attacks in the U.S. of Sept. 11, 2001.
Violence blamed on Islamic militants has spiked in recent weeks in northwestern Pakistan, including in the North and South Waziristan tribal areas that border Afghanistan.
The rising violence also comes amid increased U.S. pressure on Pakistan's Washington-backed leader, President Gen. Pervez Musharraf, to do more to crack down on militants near the frontier, where a recent U.S. intelligence report suggested al-Qaida may be regrouping.