The attack occurred about 2:30 a.m. at a prison in Bannu. The town is considered the gateway to North Waziristan, a tribal region along the Afghan border that has long been a stronghold for Taliban insurgents and several other militant groups.
Local police officials said as many as 200 Taliban militants drove up in pickups, lobbing hand grenades to break through the jail's main gate.
Once inside, a two-hour firefight broke out between the attackers and roughly 30 jail guards. The militants began freeing prisoners after the guards ran out of ammunition, officials said. No one was seriously injured or killed in the attack.
One of the prisoners freed was Adnan Rashid, on death row for an assassination attempt on former Pakistani leader Pervez Musharraf when the general was president, police said.
Officials said the jail's 944 prisoners, including some militant commanders, recently had been moved to the Bannu jail after authorities received intelligence that Taliban militants might be planning major raids on detention centers holding insurgents.
In recent years, Pakistan has sent more than 140,000 troops to battle the Pakistani Taliban across much of the tribal region along the Afghan border. The army has retaken large stretches of territory, but the militants still cling to pockets of resistance throughout the tribal belt and continue to carry out periodic attacks on a variety of targets, including military checkpoints, mosques and markets.
Like the Afghan Taliban, the Pakistani movement is made up of factions united by the goal of toppling the government and imposing Sharia, or Islamic law. It maintains links with Al Qaeda, the Afghan Taliban and other Pakistani militant groups ensconced in Pakistan's tribal belt.
Authorities in Islamabad, the capital, have blamed the Pakistani Taliban for some of the country's worst terrorist attacks, including the assassination of former Prime Minister Benazir Bhutto in December 2007.
(Special correspondent Ali reported from Peshawar and staff writer Rodriguez from Islamabad.)